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

fix: QBD direct bug fixes #1101

Merged
merged 10 commits into from
Dec 10, 2024
Merged

fix: QBD direct bug fixes #1101

merged 10 commits into from
Dec 10, 2024

Conversation

DhaaraniCIT
Copy link
Contributor

@DhaaraniCIT DhaaraniCIT commented Dec 10, 2024

Description

fix: QBD direct bug fixes

Clickup

https://app.clickup.com

Summary by CodeRabbit

  • New Features

    • Introduced a new property, detailAccountType, to enhance the handling of account types across various components.
    • Added input properties for detailAccountType in multiple components, improving data flow and flexibility.
  • Bug Fixes

    • Improved error handling and display logic for employee and category mappings, ensuring clearer error messages.
  • Documentation

    • Updated labels and placeholders in the export settings for better user understanding.
    • Corrected capitalization in branding and configuration texts for consistency.
    • Updated demo video link for onboarding resources.
  • Style

    • Minor adjustments made to HTML structure for error message formatting.
    • Updated text in onboarding components for clarity and consistency.

@DhaaraniCIT DhaaraniCIT added the deploy Triggers deployment of active branch to Staging label Dec 10, 2024
@github-actions github-actions bot added the size/XS Extra Small PR label Dec 10, 2024
Copy link

PR description must contain a link to a ClickUp (case-insensitive)

Copy link
Contributor

coderabbitai bot commented Dec 10, 2024

Warning

Rate limit exceeded

@DhaaraniCIT has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 22 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between fed0d68 and 4acb11a.

⛔ Files ignored due to path filters (2)
  • src/assets/flow-charts/fyle-qbd-direct-flow-chart.svg is excluded by !**/*.svg
  • src/assets/sprites/sprite.svg is excluded by !**/*.svg
📒 Files selected for processing (6)
  • src/app/core/models/common/advanced-settings.model.ts (1 hunks)
  • src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.html (2 hunks)
  • src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts (3 hunks)
  • src/app/shared/components/helper/app-landing-page-header/app-landing-page-header.component.html (1 hunks)
  • src/app/shared/components/helper/app-landing-page-header/app-landing-page-header.component.ts (1 hunks)
  • src/app/shared/components/helper/mapping/generic-mapping-table/generic-mapping-table.component.ts (2 hunks)

Walkthrough

The changes involve modifications to several components related to dashboard error handling and mapping functionalities. A new property, detailAccountType, has been introduced in various components to enhance the handling of account types. The DashboardErrorSectionComponent and related components have updated methods and HTML templates to incorporate this new property, improving the error display logic and the overall flexibility of the mapping functionalities. The changes focus on refining user interactions and improving the clarity of error messages and mappings.

Changes

File Path Change Summary
src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts Added property `detailAccountType: string[]
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-mapping/qbd-direct-base-mapping/qbd-direct-base-mapping.component.html Added new input property [detailAccountType] to <app-generic-mapping-v2>.
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-mapping/qbd-direct-base-mapping/qbd-direct-base-mapping.component.ts Added property `detailAccountType: string[]
src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.html Updated labels and placeholders in HTML template for clarity.
src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.html Modified error message display logic and added new input property [detailAccountType] to <app-generic-mapping-table>.
src/app/shared/components/helper/mapping/generic-mapping-table/generic-mapping-table.component.ts Added new input property `detailAccountType: string[]
src/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.html Added new input property [detailAccountType] to <app-generic-mapping-table>.
src/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.ts Added new input property `detailAccountType: string[]
src/app/core/services/common/dashboard.service.ts Updated getExportErrors method signature to remove appName parameter and adjust internal logic for error fetching.
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts Updated getExportErrors$ observable to simplify method invocation by removing unnecessary parameters.
src/app/branding/c1-contents-config.ts Updated configurationSubHeaderText for consistency in branding.
src/app/branding/fyle-branding-config.ts Updated QBD_DIRECT demo video link in fyleDemoVideoLinks.
src/app/branding/fyle-contents-config.ts Updated text strings for consistency in fyleContents related to "QuickBooks Desktop".
src/app/core/models/qbd-direct/qbd-direct-configuration/qbd-direct-advanced-settings.model.ts Corrected spelling of auto_create_reimbursable_entity in type definition.
src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-landing/qbd-direct-onboarding-landing.component.html Modified appName value and removed redirectLink property from <app-landing-page-body>.
src/app/shared/components/helper/app-landing-page-header/app-landing-page-header.component.html Adjusted conditions for displaying buttons based on application name and integration status.
src/app/shared/components/helper/app-landing-page-header/app-landing-page-header.component.ts Modified connect method to broaden the condition for displaying the connect button for QuickBooks Desktop integrations.

Possibly related PRs

Suggested labels

size/M

Suggested reviewers

  • ashwin1111

Poem

🐰 In the meadow where errors play,
A new type hops in, brightening the day.
With clearer paths and mappings anew,
We celebrate changes, both bold and true!
So let’s gather round, with joy we’ll sing,
For the detail account type, oh what joy it will bring! 🌼


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. (Experiment)
  • @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.

Copy link

PR description must contain a link to a ClickUp (case-insensitive)

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

🧹 Outside diff range and nitpick comments (1)
src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts (1)

Line range hint 1-200: Consider implementing proper error tracking

Instead of using console.log for debugging, consider:

  1. Using Angular's ErrorHandler for systematic error tracking
  2. Implementing a logging service that can be toggled based on environment
  3. Adding telemetry for better production monitoring

Example implementation:

// Create a logging service
@Injectable({
  providedIn: 'root'
})
export class LoggingService {
  logError(error: any, context: string) {
    if (environment.enableLogging) {
      // Log to your preferred logging system
      console.error(`[${context}]`, error);
    }
  }
}
🧰 Tools
🪛 GitHub Check: lint

[failure] 185-185:
Unexpected console statement


[failure] 185-185:
Missing semicolon

🪛 eslint

[error] 185-185: Unexpected console statement.

(no-console)


[error] 185-186: Missing semicolon.

(semi)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 8dabbeb and b8a9c0f.

📒 Files selected for processing (2)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts (1 hunks)
  • src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts (1 hunks)
🧰 Additional context used
🪛 GitHub Check: lint
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts

[failure] 143-143:
Unexpected console statement


[failure] 143-143:
Missing semicolon

src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts

[failure] 185-185:
Unexpected console statement


[failure] 185-185:
Missing semicolon

🪛 eslint
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts

[error] 143-143: Unexpected console statement.

(no-console)


[error] 143-144: Missing semicolon.

(semi)

src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts

[error] 185-185: Unexpected console statement.

(no-console)


[error] 185-186: Missing semicolon.

(semi)

🔇 Additional comments (1)
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts (1)

Line range hint 1-200: Clarify the bug fixes implemented

The PR title mentions "QBD direct bug fixes", but the changes only add debug logging. Could you please clarify:

  1. What specific bugs are being addressed?
  2. How does this console.log help in fixing those bugs?
  3. Are there actual fixes missing from this PR?
🧰 Tools
🪛 GitHub Check: lint

[failure] 143-143:
Unexpected console statement


[failure] 143-143:
Missing semicolon

🪛 eslint

[error] 143-143: Unexpected console statement.

(no-console)


[error] 143-144: Missing semicolon.

(semi)

@@ -140,6 +140,7 @@
this.importSettingService.getImportSettings()
]).subscribe((responses) => {
this.errors = DashboardModel.parseAPIResponseToGroupedError(responses[0].results);
console.log(this.errors)
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

Remove debugging console.log statement

Production code should not contain console.log statements. If debugging is needed, consider using proper logging services or Angular's built-in logging mechanisms.

-      console.log(this.errors)
🧰 Tools
🪛 GitHub Check: lint

[failure] 143-143:
Unexpected console statement


[failure] 143-143:
Missing semicolon

🪛 eslint

[error] 143-143: Unexpected console statement.

(no-console)


[error] 143-144: Missing semicolon.

(semi)

Comment on lines 185 to 186
console.log(this.errorExpenses)

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

Remove debugging console.log statement

Production code should not contain console.log statements. If error tracking is needed, consider using a proper logging service or Angular's error handling mechanisms.

-    console.log(this.errorExpenses)
-
🧰 Tools
🪛 GitHub Check: lint

[failure] 185-185:
Unexpected console statement


[failure] 185-185:
Missing semicolon

🪛 eslint

[error] 185-185: Unexpected console statement.

(no-console)


[error] 185-186: Missing semicolon.

(semi)

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: 1

🧹 Outside diff range and nitpick comments (8)
src/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.ts (2)

43-44: Add JSDoc documentation for the detailAccountType property

The new input property lacks documentation explaining its purpose and expected values.

+  /**
+   * Array of detail account types used for filtering QuickBooks Desktop accounts
+   * @type {string[] | undefined}
+   */
   @Input() detailAccountType: string[] | undefined;

43-44: Consider adding input validation and change detection

The property could benefit from:

  1. Input validation to ensure valid account types
  2. Implementation of OnChanges to handle property updates efficiently
-export class GenericMappingV2Component implements OnInit {
+export class GenericMappingV2Component implements OnInit, OnChanges {
+  private validateDetailAccountType(value: string[] | undefined): void {
+    if (value && !Array.isArray(value)) {
+      console.warn('detailAccountType should be an array of strings');
+    }
+  }
+
+  ngOnChanges(changes: SimpleChanges): void {
+    if (changes.detailAccountType) {
+      this.validateDetailAccountType(changes.detailAccountType.currentValue);
+    }
+  }
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-mapping/qbd-direct-base-mapping/qbd-direct-base-mapping.component.ts (2)

55-55: Consider initializing the property with a default value.

The detailAccountType property is declared without initialization. While TypeScript allows this, explicitly initializing it as undefined would improve code clarity.

-  detailAccountType: string[] | undefined;
+  detailAccountType: string[] | undefined = undefined;

Line range hint 77-81: Verify error handling for destination attributes retrieval.

The service call to getPaginatedDestinationAttributes could fail, but there's no error handling in place. This could lead to the component being stuck in a loading state.

   this.detailAccountType = detailAccountType;
-  this.mappingService.getPaginatedDestinationAttributes(this.destinationField, undefined, this.displayName, '', detailAccountType).subscribe((responses) => {
+  this.mappingService.getPaginatedDestinationAttributes(this.destinationField, undefined, this.displayName, '', detailAccountType).subscribe({
+    next: (responses) => {
     this.destinationOptions = responses.results as QbdDirectDestinationAttribute[];
     this.isLoading = false;
-  });
+    },
+    error: (error) => {
+      console.error('Failed to fetch destination attributes:', error);
+      this.isLoading = false;
+      // Consider showing an error message to the user
+    }
+  });
src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts (2)

105-105: Consider initializing the property with a default value.

The detailAccountType property is declared without initialization. While TypeScript allows this, explicitly initializing it as undefined would improve code clarity.

-  detailAccountType: string[] | undefined;
+  detailAccountType: string[] | undefined = undefined;

150-157: Improve code readability with early returns.

The nested if-else conditions can be simplified using early returns, making the code more maintainable.

   if (this.sourceField === 'EMPLOYEE') {
-    this.destinationOptions = this.destinationField === FyleField.EMPLOYEE ? groupedDestinationResponse.EMPLOYEE : groupedDestinationResponse.VENDOR;
-    this.detailAccountType = undefined;
+    this.detailAccountType = undefined;
+    this.destinationOptions = this.destinationField === FyleField.EMPLOYEE 
+      ? groupedDestinationResponse.EMPLOYEE 
+      : groupedDestinationResponse.VENDOR;
+    return;
   }
-  } else if (this.sourceField === 'CATEGORY') {
-    if (this.destinationField === 'EXPENSE_TYPE') {
-      this.destinationOptions = groupedDestinationResponse.EXPENSE_TYPE;
-    } else {
-      this.detailAccountType = this.chartOfAccounts;
-      this.destinationOptions = this.appName !== AppName.QBD_DIRECT ? groupedDestinationResponse.ACCOUNT : this.destinationOptionsWatcher(this.chartOfAccounts, groupedDestinationResponse.ACCOUNT as QbdDirectDestinationAttribute[]);
-    }
+  
+  if (this.sourceField === 'CATEGORY') {
+    if (this.destinationField === 'EXPENSE_TYPE') {
+      this.destinationOptions = groupedDestinationResponse.EXPENSE_TYPE;
+      return;
+    }
+    
+    this.detailAccountType = this.chartOfAccounts;
+    this.destinationOptions = this.appName !== AppName.QBD_DIRECT 
+      ? groupedDestinationResponse.ACCOUNT 
+      : this.destinationOptionsWatcher(this.chartOfAccounts, groupedDestinationResponse.ACCOUNT as QbdDirectDestinationAttribute[]);
+    return;
   }
src/app/shared/components/helper/mapping/generic-mapping-table/generic-mapping-table.component.ts (2)

49-49: Consider initializing the input property with a default value.

The detailAccountType input property is declared without initialization. While TypeScript allows this, explicitly initializing it as undefined would improve code clarity.

-  @Input() detailAccountType: string[] | undefined;
+  @Input() detailAccountType: string[] | undefined = undefined;

Line range hint 137-148: Add error handling and loading state management.

The service call to getPaginatedDestinationAttributes lacks error handling and proper loading state management.

-      this.mappingService.getPaginatedDestinationAttributes(this.destinationField, event.searchTerm, this.displayName, this.appName, this.detailAccountType).subscribe((response) => {
+      this.mappingService.getPaginatedDestinationAttributes(
+        this.destinationField,
+        event.searchTerm,
+        this.displayName,
+        this.appName,
+        this.detailAccountType
+      ).subscribe({
+        next: (response) => {
         response.results.forEach((option) => {
           // If option is not already present in the list, add it
           if (!this.optionsMap[option.id.toString()]) {
             this.optionsMap[option.id.toString()] = true;
             newOptions.push(option);
           }
         });
 
         this.destinationOptions = existingOptions.concat(newOptions);
         this.sortDropdownOptions();
         this.isSearching = false;
-      });
+        },
+        error: (error) => {
+          console.error('Failed to fetch destination attributes:', error);
+          this.isSearching = false;
+          // Consider showing an error message to the user
+        }
+      });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b8a9c0f and 1da613e.

📒 Files selected for processing (8)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-mapping/qbd-direct-base-mapping/qbd-direct-base-mapping.component.html (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-mapping/qbd-direct-base-mapping/qbd-direct-base-mapping.component.ts (2 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.html (2 hunks)
  • src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.html (2 hunks)
  • src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts (3 hunks)
  • src/app/shared/components/helper/mapping/generic-mapping-table/generic-mapping-table.component.ts (2 hunks)
  • src/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.html (1 hunks)
  • src/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.ts (1 hunks)
🔇 Additional comments (7)
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-mapping/qbd-direct-base-mapping/qbd-direct-base-mapping.component.html (1)

11-11: Verify detailAccountType implementation in component class

The new property binding looks correct, but we should ensure that the detailAccountType property is properly defined and initialized in the component class.

✅ Verification successful

Property detailAccountType is properly implemented in component class

The detailAccountType property is correctly defined in the component class as an optional string array (detailAccountType: string[] | undefined). It's properly initialized and managed through the destinationOptionsWatcher method, which is called from various component methods like getCCCAccountOptions and getAccountOptions. The implementation aligns with the template binding.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for detailAccountType property definition in the component
rg "detailAccountType.*QbdDirectBaseMappingComponent" -A 5

Length of output: 60


Script:

#!/bin/bash
# Let's try a broader search for the component file and look for detailAccountType
fd -e ts "qbd-direct-base-mapping.component" --exec rg -l "detailAccountType" {}

# If found, let's see the implementation details
fd -e ts "qbd-direct-base-mapping.component" --exec cat {}

Length of output: 6432

src/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.html (1)

16-16: Verify detailAccountType handling in generic-mapping-table component

The property is correctly passed down, but we should verify that the generic-mapping-table component properly declares and handles this property.

✅ Verification successful

Let me gather more context about how this property is used in the mapping service.


Based on the results, I can now provide the final response:

Property detailAccountType is properly handled in generic-mapping-table component

The property is correctly declared as an input property and is properly used in the component's logic to filter destination attributes when making API calls:

  • Input declaration: @Input() detailAccountType: string[] | undefined;
  • Usage in getPaginatedDestinationAttributes service call to filter destination attributes based on account type
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for detailAccountType property definition in the table component
rg "detailAccountType.*GenericMappingTableComponent" -A 5

# Search for usage of detailAccountType in the component logic
rg "detailAccountType" --type ts src/app/shared/components/helper/mapping/generic-mapping-table/

Length of output: 587


Script:

#!/bin/bash
# Search for getPaginatedDestinationAttributes method implementation
ast-grep --pattern 'getPaginatedDestinationAttributes($$$) {
  $$$
}'

# Also check for any interfaces or types that might define this method's signature
rg "getPaginatedDestinationAttributes" -A 3 --type ts

Length of output: 30777

src/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.ts (1)

43-44: Verify the integration with QuickBooks Desktop API

Since this property is related to QBD account types, we should verify that the values match QuickBooks Desktop's supported account types.

src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.html (2)

Line range hint 81-91: Improved error detail display structure and accessibility.

The changes enhance the error detail section with better HTML structure and accessibility features:

  • Proper paragraph wrapping for error details
  • Accessible link styling with cursor pointer
  • Inline-flex alignment for better visual hierarchy

138-138: Verify the detailAccountType property implementation.

The new detailAccountType property has been added to the app-generic-mapping-table component. This property likely affects how account types are handled in the mapping process.

✅ Verification successful

Based on the shell script results, I can now generate the final response as the implementation is clear:

The detailAccountType property is properly implemented and used consistently

The property is:

  • Correctly defined as an optional string array (string[] | undefined) in both the parent and child components
  • Used in the mapping service to filter destination attributes
  • Properly passed through the component hierarchy from dashboard-error-section to generic-mapping-table
  • Implements account type filtering logic in destinationOptionsWatcher method
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the detailAccountType property definition and usage
echo "Searching for detailAccountType property definition:"
ast-grep --pattern 'class $_ {
  $$$
  detailAccountType: $_
  $$$
}'

echo "Searching for detailAccountType property usage:"
rg "detailAccountType" -A 3

Length of output: 10020

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

67-71: Improved clarity in reimbursable account settings.

The changes enhance user understanding by:

  • Using more specific error message text
  • Maintaining consistency with credit card terminology
  • Adding dynamic context based on the export type

206-210: Consistent terminology in credit card account settings.

The changes maintain consistency with the reimbursable account section by:

  • Using identical error message terminology
  • Matching placeholder text
  • Following the same pattern for dynamic labels

Comment on lines +217 to +219
const errorVersion = this.appName === AppName.QBD_DIRECT ? this.appName : this.errorsVersion;
this.dashboardService.getExportErrors(errorVersion).subscribe((errors) => {
const argument = errorVersion === 'v1' ? errors : (errors as ErrorResponse).results;
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

Add error handling for export errors retrieval.

The service call to getExportErrors lacks error handling, which could lead to unhandled exceptions.

-    this.dashboardService.getExportErrors(errorVersion).subscribe((errors) => {
+    this.dashboardService.getExportErrors(errorVersion).subscribe({
+      next: (errors) => {
       const argument = errorVersion === 'v1' ? errors : (errors as ErrorResponse).results;
       const newError: AccountingGroupedErrors = this.formatErrors(argument);
+      },
+      error: (error) => {
+        console.error('Failed to fetch export errors:', error);
+        // Consider showing an error message to the user
+      }
+    });

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

@github-actions github-actions bot added size/S Small PR and removed size/XS Extra Small PR labels Dec 10, 2024
Copy link

PR description must contain a link to a ClickUp (case-insensitive)

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: 0

🧹 Outside diff range and nitpick comments (1)
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts (1)

Line range hint 116-146: Consider enhancing error handling in pollExportStatus

While the changes look good, consider improving error handling in the forkJoin subscription to handle potential failures gracefully.

 forkJoin([
   this.getExportErrors$,
   this.getAccountingExportSummary$
-]).subscribe(responses => {
+]).pipe(
+  catchError(error => {
+    console.error('Error fetching export data:', error);
+    this.isExportInProgress = false;
+    return of([{ results: [] }, null]);
+  })
+).subscribe(responses => {
   this.errors = DashboardModel.parseAPIResponseToGroupedError(responses[0].results);
   this.groupedErrorStat = {
     EMPLOYEE_MAPPING: null,
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1da613e and 0bfe78e.

📒 Files selected for processing (2)
  • src/app/core/services/common/dashboard.service.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts (1 hunks)
🔇 Additional comments (2)
src/app/core/services/common/dashboard.service.ts (1)

Line range hint 39-46: Verify all callers of getExportErrors()

The method signature change (removal of appName parameter) looks good and simplifies the API. However, we should verify that all callers have been updated accordingly.

✅ Verification successful

Let me analyze the callers of getExportErrors() to verify if they are correctly using the updated method signature.


Based on the analysis of all callers of getExportErrors(), I can now generate the final response:

All callers are correctly using the updated method signature

The verification shows that all callers are properly aligned with the new method signature:

  • QBD Direct component correctly passes AppName.QBD_DIRECT
  • Multiple components (Xero, QBO, Intacct, Netsuite) correctly pass 'v1'
  • Business Central and Sage300 components correctly use the method without parameters
  • The shared dashboard-error-section component correctly handles version selection based on app name
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for all calls to getExportErrors to ensure they've been updated
rg "getExportErrors\(" --type ts

Length of output: 1714


Script:

#!/bin/bash
# Let's check the content of dashboard-error-section.component.ts to understand how errorVersion is determined
rg -B 5 -A 5 "errorVersion" src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.ts

Length of output: 772

src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts (1)

55-55: LGTM! Observable declaration updated correctly

The observable declaration has been properly updated to match the new service method signature, passing AppName.QBD_DIRECT directly.

Copy link

PR description must contain a link to a ClickUp (case-insensitive)

@DhaaraniCIT DhaaraniCIT added size/XS Extra Small PR deploy Triggers deployment of active branch to Staging and removed deploy Triggers deployment of active branch to Staging size/S Small PR labels Dec 10, 2024
@github-actions github-actions bot added size/M Medium PR and removed size/XS Extra Small PR labels Dec 10, 2024
Copy link

PR description must contain a link to a ClickUp (case-insensitive)

@@ -64,11 +64,11 @@
(searchOptionsDropdown)="searchOptionsDropdown($event)"
[optionLabel]="'value'"
[isFieldMandatory]="true"
[mandatoryErrorListName]="'accounts payable'"
Copy link
Contributor

Choose a reason for hiding this comment

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

revert back

[label]="brandingContent.reimbursable.defaultReimbursableAccountPayableLabel + (exportSettingsForm.get('reimbursableExportType')?.value | snakeCaseToSpaceCase | titlecase)"
[subLabel]="brandingContent.reimbursable.defaultReimbursableAccountPayableSubLabel + (exportSettingsForm.get('reimbursableExportType')?.value | snakeCaseToSpaceCase | titlecase) + ' ,while debit lines will reflect the category chosen by the employee for each respective expense'"
[iconPath]="'list'"
[placeholder]="'Select accounts payable'"
Copy link
Contributor

Choose a reason for hiding this comment

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

revert back

@@ -203,11 +203,11 @@
(searchOptionsDropdown)="searchOptionsDropdown($event)"
[optionLabel]="'value'"
[isFieldMandatory]="true"
[mandatoryErrorListName]="'accounts payable'"
Copy link
Contributor

Choose a reason for hiding this comment

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

same

[label]="brandingContent.corporateCard.defaultCCCAccountPayableLabel + (exportSettingsForm.get('creditCardExportType')?.value | snakeCaseToSpaceCase | titlecase)"
[subLabel]="brandingContent.corporateCard.defaultCCCAccountPayableSubLabel + (exportSettingsForm.get('creditCardExportType')?.value | snakeCaseToSpaceCase | titlecase) + ' ,while debit lines will reflect the category chosen by the employee for each respective expense'"
[iconPath]="'list'"
[placeholder]="'Select accounts payable'"
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Copy link

PR description must contain a link to a ClickUp (case-insensitive)

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: 3

🧹 Outside diff range and nitpick comments (3)
src/app/core/models/qbd-direct/qbd-direct-configuration/qbd-direct-advanced-settings.model.ts (1)

Line range hint 23-89: Consider architectural improvements for maintainability

  1. The extensive use of static methods makes the code harder to test and creates tight coupling. Consider making these instance methods or moving them to a separate service.

  2. The form control initialization pattern could be simplified using a helper method:

private static initFormControl<T>(value: T | undefined, defaultValue: T): FormControl {
  return new FormControl(value ?? defaultValue);
}
  1. Consider adding type safety for memo structure fields using string literals:
type MemoField = 'employee_name' | 'employee_email' | 'card_number' | 'purpose' | 'merchant' | 'spent_on' | 'expense_key' | 'expense_link';
src/app/shared/components/helper/app-landing-page-header/app-landing-page-header.component.ts (1)

93-93: Consider using an enum or constant for QuickBooks Desktop string

While the condition change makes sense for flexibility, having the string 'QuickBooks Desktop ' hardcoded could lead to maintenance issues. Consider defining it as a constant or adding it to the AppName enum.

- if (this.appName === AppName.TRAVELPERK || this.appName === AppName.BUSINESS_CENTRAL || this.appName === AppName.BAMBOO_HR || this.appName === AppName.XERO || this.appName.includes('QuickBooks Desktop ')) {
+ const QBD_APP_NAME_PREFIX = 'QuickBooks Desktop ';
+ if (this.appName === AppName.TRAVELPERK || this.appName === AppName.BUSINESS_CENTRAL || this.appName === AppName.BAMBOO_HR || this.appName === AppName.XERO || this.appName.includes(QBD_APP_NAME_PREFIX)) {
src/app/shared/components/helper/app-landing-page-header/app-landing-page-header.component.html (1)

43-45: Maintain consistency with component's TypeScript conditions

The HTML template uses the same string check as the TypeScript file. To improve maintainability:

  1. Use the same constant/enum suggested for the TypeScript file
  2. Consider extracting the complex condition into a component method
- *ngIf="!isIntegrationConnected && (appName === AppName.QBD || appName === AppName.NETSUITE || appName === AppName.INTACCT || appName === AppName.SAGE300 || appName === AppName.BUSINESS_CENTRAL || appName.includes('QuickBooks Desktop '))"
+ *ngIf="!isIntegrationConnected && isValidIntegration()"

Add to component:

isValidIntegration(): boolean {
  return this.appName === AppName.QBD || 
         this.appName === AppName.NETSUITE || 
         this.appName === AppName.INTACCT || 
         this.appName === AppName.SAGE300 || 
         this.appName === AppName.BUSINESS_CENTRAL || 
         this.appName.includes(QBD_APP_NAME_PREFIX);
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0bfe78e and c25229f.

📒 Files selected for processing (8)
  • src/app/branding/c1-contents-config.ts (1 hunks)
  • src/app/branding/fyle-branding-config.ts (1 hunks)
  • src/app/branding/fyle-contents-config.ts (1 hunks)
  • src/app/core/models/qbd-direct/qbd-direct-configuration/qbd-direct-advanced-settings.model.ts (3 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-landing/qbd-direct-onboarding-landing.component.html (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.html (2 hunks)
  • src/app/shared/components/helper/app-landing-page-header/app-landing-page-header.component.html (1 hunks)
  • src/app/shared/components/helper/app-landing-page-header/app-landing-page-header.component.ts (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • src/app/branding/c1-contents-config.ts
  • src/app/branding/fyle-branding-config.ts
  • src/app/branding/fyle-contents-config.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.html
🔇 Additional comments (2)
src/app/core/models/qbd-direct/qbd-direct-configuration/qbd-direct-advanced-settings.model.ts (1)

12-12: ⚠️ Potential issue

Fix inconsistent property naming across the codebase

While the type definition correctly uses auto_create_reimbursable_entity, the form control still uses the misspelled version autoCreateReimbursableEnitity. This inconsistency should be fixed.

Let's verify other occurrences of this property name in the codebase:

src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-landing/qbd-direct-onboarding-landing.component.html (1)

6-6: Verify removal of redirectLink property

The redirectLink property has been removed from app-landing-page-body. This might affect the "Read more" functionality for QBD integration documentation.

@@ -79,7 +79,7 @@ export class QbdDirectAdvancedSettingsModel extends AdvancedSettingsModel {
schedule_is_enabled: advancedSettingForm.get('exportSchedule')?.value ? advancedSettingForm.get('exportSchedule')?.value : false,
emails_selected: advancedSettingForm.get('exportSchedule')?.value ? selectedEmailsEmails : [],
interval_hours: advancedSettingForm.get('exportSchedule')?.value ? advancedSettingForm.get('exportScheduleFrequency')?.value : null,
auto_create_reimbursable_enitity: advancedSettingForm.get('autoCreateReimbursableEnitity')?.value ? advancedSettingForm.get('autoCreateReimbursableEnitity')?.value : false,
auto_create_reimbursable_entity: advancedSettingForm.get('autoCreateReimbursableEnitity')?.value ? advancedSettingForm.get('autoCreateReimbursableEnitity')?.value : false,
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

Fix form control access in payload construction

The payload construction attempts to access the misspelled form control while assigning to the correctly spelled property.

Apply this fix:

-            auto_create_reimbursable_entity: advancedSettingForm.get('autoCreateReimbursableEnitity')?.value ? advancedSettingForm.get('autoCreateReimbursableEnitity')?.value : false,
+            auto_create_reimbursable_entity: advancedSettingForm.get('autoCreateReimbursableEntity')?.value ? advancedSettingForm.get('autoCreateReimbursableEntity')?.value : false,
📝 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
auto_create_reimbursable_entity: advancedSettingForm.get('autoCreateReimbursableEnitity')?.value ? advancedSettingForm.get('autoCreateReimbursableEnitity')?.value : false,
auto_create_reimbursable_entity: advancedSettingForm.get('autoCreateReimbursableEntity')?.value ? advancedSettingForm.get('autoCreateReimbursableEntity')?.value : false,

@@ -56,7 +56,7 @@
exportSchedule: new FormControl(advancedSettings?.schedule_is_enabled ? advancedSettings?.schedule_is_enabled : false),
email: new FormControl(advancedSettings?.emails_selected ? advancedSettings?.emails_selected : null),
exportScheduleFrequency: new FormControl(advancedSettings?.schedule_is_enabled ? advancedSettings?.interval_hours : 1),
autoCreateReimbursableEnitity: new FormControl(advancedSettings?.auto_create_reimbursable_enitity ? advancedSettings?.auto_create_reimbursable_enitity : false),
autoCreateReimbursableEnitity: new FormControl(advancedSettings?.auto_create_reimbursable_entity ? advancedSettings?.auto_create_reimbursable_entity : false),
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

Fix form control name to match type definition

The form control name uses the misspelled version autoCreateReimbursableEnitity while accessing a correctly spelled property from the API response.

Apply this fix:

-            autoCreateReimbursableEnitity: new FormControl(advancedSettings?.auto_create_reimbursable_entity ? advancedSettings?.auto_create_reimbursable_entity : false),
+            autoCreateReimbursableEntity: new FormControl(advancedSettings?.auto_create_reimbursable_entity ? advancedSettings?.auto_create_reimbursable_entity : false),
📝 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
autoCreateReimbursableEnitity: new FormControl(advancedSettings?.auto_create_reimbursable_entity ? advancedSettings?.auto_create_reimbursable_entity : false),
autoCreateReimbursableEntity: new FormControl(advancedSettings?.auto_create_reimbursable_entity ? advancedSettings?.auto_create_reimbursable_entity : false),

@@ -1,8 +1,8 @@
<div>
<div>
<app-landing-page-header [buttonText]="'Start'" [iconPath]="'assets/logos/qbo.png'" [appName]="'QuickBooks Desktop - Direct Integration'" [appDescription]="brandingContent.contentText" [isConnectionInProgress]="isQbdConnectionInProgress" [isLoading]="false" [isIntegrationConnected]="false" [redirectLink]="redirectLink" (connectIntegration)="connectQbdDirect()" [logoStyleClasses]="'tw-p-16-px'"></app-landing-page-header>
<app-landing-page-header [buttonText]="'Start'" [iconPath]="'assets/logos/qbo.png'" [appName]="'QuickBooks Desktop '" [appDescription]="brandingContent.contentText" [isConnectionInProgress]="isQbdConnectionInProgress" [isLoading]="false" [isIntegrationConnected]="false" [redirectLink]="redirectLink" (connectIntegration)="connectQbdDirect()" [logoStyleClasses]="'tw-p-16-px'"></app-landing-page-header>
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Based on the search results, I can now generate the final response:

Remove trailing space from QuickBooks Desktop string

The trailing space in 'QuickBooks Desktop ' is indeed problematic as it's being used inconsistently across the codebase:

  • Most occurrences use 'QuickBooks Desktop' (without space)
  • Only the landing page header component has special handling with .includes('QuickBooks Desktop ')
  • This inconsistency could lead to bugs if the string comparison logic changes

The proper fix would be to:

  1. Remove the trailing space from qbd-direct-onboarding-landing.component.html
  2. Update the condition in app-landing-page-header.component.ts to use exact string comparison instead of includes()
🔗 Analysis chain

Verify the impact of appName change

The appName has been changed to 'QuickBooks Desktop ' to match the new condition checks. However:

  1. The trailing space in the string seems like a fragile solution
  2. This change should be verified across all QBD integration flows
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other instances of QuickBooks Desktop string to ensure consistency
rg -l "QuickBooks Desktop" | while read -r file; do
  echo "=== $file ==="
  rg "QuickBooks Desktop" "$file"
done

Length of output: 25142

@DhaaraniCIT DhaaraniCIT removed size/M Medium PR deploy Triggers deployment of active branch to Staging labels Dec 10, 2024
Copy link

PR description must contain a link to a ClickUp (case-insensitive)

@DhaaraniCIT DhaaraniCIT added the deploy Triggers deployment of active branch to Staging label Dec 10, 2024
@github-actions github-actions bot added the size/M Medium PR label Dec 10, 2024
Copy link

Unit Test Coverage % values
Statements 34.05% ( 4199 / 12329 )
Branches 27.73% ( 1210 / 4363 )
Functions 26.69% ( 922 / 3454 )
Lines 34.21% ( 4131 / 12073 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy Triggers deployment of active branch to Staging size/M Medium PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants