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: Prod fixes of QBD direct #1118

Merged
merged 3 commits into from
Dec 12, 2024
Merged

fix: Prod fixes of QBD direct #1118

merged 3 commits into from
Dec 12, 2024

Conversation

DhaaraniCIT
Copy link
Contributor

@DhaaraniCIT DhaaraniCIT commented Dec 12, 2024

Description

fix: Prod fixes of QBD direct

app changes
remove error message shown in company path, check only for not empty string - p0
commits.tsv - p0
category mappings - p0
if category import is on -> today's behavior is right
if category import is off -> send all account types in detail query param
export settings -> reimbursable/ccc grouping help text fix - p1
advanced settings top level preview - p2
updated the KB article as well

Clickup

https://app.clickup.com

Export settings
Screenshot 2024-12-12 at 1 21 27 PM

Screenshot 2024-12-12 at 1 21 40 PM Screenshot 2024-12-12 at 1 22 11 PM

Advanced settings
Screenshot 2024-12-12 at 1 22 42 PM

Mapping

when import category is off
Screenshot 2024-12-12 at 1 25 21 PM

Screenshot 2024-12-12 at 1 24 50 PM

when import category is on
Screenshot 2024-12-12 at 1 26 15 PM

Screenshot 2024-12-12 at 1 26 38 PM

Summary by CodeRabbit

  • New Features

    • Updated article links for QuickBooks Desktop integration to point to new beta resources.
    • Enhanced user interface with new input bindings and a preview section in the advanced settings component.
  • Bug Fixes

    • Improved validation logic for file path input in the onboarding connector component.
  • Documentation

    • Comments updated to indicate future updates for certain integration links.
  • Refactor

    • Streamlined the structure of onboarding articles and memo handling within components.
  • Style

    • Adjusted conditional rendering logic in templates for better clarity and maintainability.

Copy link
Contributor

coderabbitai bot commented Dec 12, 2024

Walkthrough

The changes in this pull request involve modifications to various branding configuration files and components related to the QBD (QuickBooks Desktop) integration. Key alterations include restructuring the c1KbArticles and fyleKbArticles to reflect updated documentation links, as well as adjustments to the KbArticle type definition. Additionally, the QbdDirectDashboardComponent and other components have been updated to incorporate new logic for handling chart of accounts and improved user interface elements. These changes aim to enhance the organization and accessibility of resources related to QBD.

Changes

File Change Summary
src/app/branding/c1-branding-config.ts Removed LANDING and SKIP_EXPORT properties from c1KbArticles.QBD_DIRECT, added HELPER_ARTICLE.
src/app/branding/fyle-branding-config.ts Updated URL for QBD_DIRECT and its onboarding articles to point to new beta integration articles.
src/app/core/models/branding/kb-article.model.ts Removed LANDING and SKIP_EXPORT fields from onboardingArticles.QBD_DIRECT.
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts Modified setupPage method to include conditional logic for this.chartOfAccounts.
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-mapping/qbd-direct-base-mapping/qbd-direct-base-mapping.component.ts Updated setupPage method with new logic for this.chartOfAccounts assignment.
src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.ts Changed triggerDownload method to simplify file path validation and adjust loading state timing.
src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-advanced-settings/qbd-direct-advanced-settings.component.html Added new input binding and improved UI structure with a description field and memo preview.
src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-advanced-settings/qbd-direct-advanced-settings.component.ts Added redirectLink, removed skipExportRedirectLink, and introduced createTopMemoStructureWatcher method.
src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.html Refined conditional rendering logic for dropdowns and messages based on application state.

Possibly related PRs

Suggested labels

deploy, size/L

Suggested reviewers

  • ashwin1111

🐰 In the land of code, where changes abound,
New links and articles, in structure they're found.
With dashboards and settings, all polished and bright,
We hop through the updates, a joyful delight!
So here's to the tweaks, both big and small,
A leap for our project, let's celebrate them all! 🎉


📜 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 3299776 and 1d1e5fb.

📒 Files selected for processing (1)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.ts

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.

@github-actions github-actions bot added the size/M Medium PR label Dec 12, 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

🧹 Outside diff range and nitpick comments (2)
src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.html (1)

100-101: Improve template readability and maintainability

While the logic is correct, the template conditions are complex and could be simplified for better maintainability.

Consider these improvements:

  1. Move the complex conditions to the component class:
- <span *ngIf="(appName === AppName.QBD_DIRECT && form.controls.creditCardExportType.value === 'CREDIT_CARD_PURCHASE' && formControllerName === 'creditCardExportGroup') || (appName !== AppName.QBD_DIRECT)">Auto-selected based on your export module</span>
- <span *ngIf="(formControllerName === 'reimbursableExportGroup' && form.controls.reimbursableExportType.value !== 'BILL' && appName === AppName.QBD_DIRECT) || (appName === AppName.QBD_DIRECT && form.controls.creditCardExportType.value !== 'CREDIT_CARD_PURCHASE' && formControllerName === 'creditCardExportGroup')"> Auto-selected when your default credit account is set to an Accounts Payable account</span>
+ <span *ngIf="shouldShowExportModuleMessage()">Auto-selected based on your export module</span>
+ <span *ngIf="shouldShowApAccountMessage()">{{getApAccountMessage()}}</span>
  1. Add these methods to the component class:
private readonly CREDIT_CARD_PURCHASE = 'CREDIT_CARD_PURCHASE';
private readonly BILL = 'BILL';

shouldShowExportModuleMessage(): boolean {
  return (
    (this.appName === AppName.QBD_DIRECT &&
      this.form.controls.creditCardExportType.value === this.CREDIT_CARD_PURCHASE &&
      this.formControllerName === 'creditCardExportGroup') ||
    this.appName !== AppName.QBD_DIRECT
  );
}

shouldShowApAccountMessage(): boolean {
  return (
    (this.formControllerName === 'reimbursableExportGroup' &&
      this.form.controls.reimbursableExportType.value !== this.BILL &&
      this.appName === AppName.QBD_DIRECT) ||
    (this.appName === AppName.QBD_DIRECT &&
      this.form.controls.creditCardExportType.value !== this.CREDIT_CARD_PURCHASE &&
      this.formControllerName === 'creditCardExportGroup')
  );
}

getApAccountMessage(): string {
  return 'Auto-selected when your default credit account is set to an Accounts Payable account';
}
  1. Alternatively, consider using ng-template for better organization:
<ng-container *ngTemplateOutlet="autoSelectionMessage"></ng-container>

<ng-template #autoSelectionMessage>
  <ng-container [ngSwitch]="true">
    <span *ngSwitchCase="shouldShowExportModuleMessage()">
      Auto-selected based on your export module
    </span>
    <span *ngSwitchCase="shouldShowApAccountMessage()">
      {{getApAccountMessage()}}
    </span>
  </ng-container>
</ng-template>
src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.ts (1)

Line range hint 90-96: Fix loading state management and add error handling.

The code has several issues:

  1. Loading state is incorrectly set to false before the HTTP request completes
  2. Missing error handling for the HTTP request
-this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath}).subscribe((connectionResponse: QbdConnectorGet) => {
+this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath}).subscribe({
+  next: (connectionResponse: QbdConnectorGet) => {
      this.password = connectionResponse.password;
      this.xmlFileContent = connectionResponse.qwc;
      this.triggerManualDownload();
      this.showDownloadLink = true;
+     this.isDownloadfileLoading = false;
+  },
+  error: (error) => {
+    this.toastService.displayToastMessage(ToastSeverity.ERROR, 'Failed to process file path. Please try again.');
+    this.isDownloadfileLoading = false;
+  }
});
-this.isDownloadfileLoading = false;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2f342c0 and 7b671c9.

⛔ Files ignored due to path filters (1)
  • commits.tsv is excluded by !**/*.tsv
📒 Files selected for processing (9)
  • src/app/branding/c1-branding-config.ts (0 hunks)
  • src/app/branding/fyle-branding-config.ts (2 hunks)
  • src/app/core/models/branding/kb-article.model.ts (0 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts (2 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-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-advanced-settings/qbd-direct-advanced-settings.component.html (3 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-advanced-settings/qbd-direct-advanced-settings.component.ts (4 hunks)
  • src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.html (1 hunks)
💤 Files with no reviewable changes (2)
  • src/app/core/models/branding/kb-article.model.ts
  • src/app/branding/c1-branding-config.ts
🔇 Additional comments (7)
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-mapping/qbd-direct-base-mapping/qbd-direct-base-mapping.component.ts (1)

110-110: Verify the impact of chart of accounts changes

The conditional logic for chartOfAccounts assignment has been modified to use either the imported chart of accounts or a predefined list based on import_account_as_category. This change could affect existing mappings.

✅ Verification successful

Let me gather more information about the impact by checking how the chart of accounts is used in mappings and any dependencies.


Based on the analysis of the shell script results, I can now provide a final response:

Chart of accounts change is safe and properly handled

The modification to use either imported chart of accounts or predefined list is safe because:

  1. The change is consistently implemented across both mapping and dashboard components
  2. The predefined list from getChartOfAccountTypesList() serves as a fallback when import_account_as_category is false
  3. Existing mappings will continue to work as the chart of accounts options are dynamically loaded during component initialization
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for existing mappings that might be affected by the chart of accounts changes

# Search for mapping references to chart_of_accounts
rg -A 5 "chart_of_accounts" --type ts

# Search for any existing mapping configurations
ast-grep --pattern 'chartOfAccounts = $_'

Length of output: 5403


Script:

#!/bin/bash
# Check for usage of chartOfAccounts in mapping logic and UI
rg -A 10 "chartOfAccounts" --type ts

# Check for any mapping-related components that might use these values
rg -A 5 "getChartOfAccountTypesList" --type ts

# Look for any mapping storage or persistence logic
ast-grep --pattern 'class $_ extends QbdDirectBaseMappingComponent'

Length of output: 30694

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

92-97: LGTM! Enhanced user experience with preview section

The addition of a preview section for the top-level memo structure improves user understanding by providing immediate visual feedback.


124-124: Verify the removal of redirectLink

The removal of the redirectLink from the skip export toggle field might affect the help documentation accessibility.

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

155-155: LGTM! Consistent implementation of chart of accounts logic

The implementation maintains consistency with the base mapping component, using the same conditional logic for chartOfAccounts assignment based on import_account_as_category.

src/app/branding/fyle-branding-config.ts (2)

70-70: LGTM: URL update maintains consistency with other article links.

The URL structure follows the established pattern using brandingConfig.helpArticleDomain.


129-132: Verify beta documentation readiness.

The URLs point to a beta integration article. Ensure that the documentation is complete and accurate before releasing to production.

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

67-67: LGTM: Consistent article reference.

The redirectLink property correctly references the advanced settings article using the branding configuration.

Comment on lines 86 to 88
// No empty input test, test for non whitespaces like spaces, tabs, etc.
const filePathRegex = /^\s*\S.*$/;
this.isCompanyPathInvalid = filePathRegex.test(filePath);
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 stricter file path validation.

The current regex only checks for non-empty input, which might be too permissive. Consider validating the file extension to ensure it's a valid QuickBooks file path.

-const filePathRegex = /^\s*\S.*$/;
+const filePathRegex = /^\s*\S.*\.qbw$/i;
📝 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
// No empty input test, test for non whitespaces like spaces, tabs, etc.
const filePathRegex = /^\s*\S.*$/;
this.isCompanyPathInvalid = filePathRegex.test(filePath);
// No empty input test, test for non whitespaces like spaces, tabs, etc.
const filePathRegex = /^\s*\S.*\.qbw$/i;
this.isCompanyPathInvalid = filePathRegex.test(filePath);

Comment on lines +202 to +209
private createTopMemoStructureWatcher(): void {
this.memoStructure = this.advancedSettingsForm.value.topMemoStructure;
this.topMemoPreviewText = QbdDirectAdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultTopMemoOptions)[0];
this.advancedSettingsForm.controls.topMemoStructure.valueChanges.subscribe((memoChanges) => {
this.memoStructure = memoChanges;
this.topMemoPreviewText = QbdDirectAdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultTopMemoOptions)[0];
});
}
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

Prevent potential memory leak in subscription.

The subscription to topMemoStructure valueChanges should be cleaned up when the component is destroyed.

+private topMemoSubscription: Subscription;

private createTopMemoStructureWatcher(): void {
    this.memoStructure = this.advancedSettingsForm.value.topMemoStructure;
    this.topMemoPreviewText = QbdDirectAdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultTopMemoOptions)[0];
-   this.advancedSettingsForm.controls.topMemoStructure.valueChanges.subscribe((memoChanges) => {
+   this.topMemoSubscription = this.advancedSettingsForm.controls.topMemoStructure.valueChanges.subscribe((memoChanges) => {
      this.memoStructure = memoChanges;
      this.topMemoPreviewText = QbdDirectAdvancedSettingsModel.formatMemoPreview(this.memoStructure, this.defaultTopMemoOptions)[0];
    });
}

+ngOnDestroy(): void {
+  if (this.topMemoSubscription) {
+    this.topMemoSubscription.unsubscribe();
+  }
+}

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

Comment on lines 87 to 88
const filePathRegex = /^\s*\S.*$/;
this.isCompanyPathInvalid = filePathRegex.test(filePath);
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we even need regex for simple comparison, can just do if (filePath) {...}

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7b671c9 and 3299776.

📒 Files selected for processing (1)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.ts (1 hunks)
🧰 Additional context used
🪛 eslint
src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.ts

[error] 86-86: Expected space(s) after "if".

(keyword-spacing)

Comment on lines +87 to +95
this.isDownloadfileLoading = true;
this.isCompanyPathInvalid = false;
this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath}).subscribe((connectionResponse: QbdConnectorGet) => {
this.password = connectionResponse.password;
this.xmlFileContent = connectionResponse.qwc;
this.triggerManualDownload();
this.showDownloadLink = true;
});
this.isDownloadfileLoading = false;
});
this.isDownloadfileLoading = 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 loading state management

The loading state is incorrectly managed. Setting isDownloadfileLoading = false outside the subscription will execute before the API call completes, leading to incorrect UI state.

 if(filePath) {
   this.isDownloadfileLoading = true;
   this.isCompanyPathInvalid = false;
   this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath}).subscribe((connectionResponse: QbdConnectorGet) => {
     this.password = connectionResponse.password;
     this.xmlFileContent = connectionResponse.qwc;
     this.triggerManualDownload();
     this.showDownloadLink = true;
+    this.isDownloadfileLoading = false;
   });
-  this.isDownloadfileLoading = 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
this.isDownloadfileLoading = true;
this.isCompanyPathInvalid = false;
this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath}).subscribe((connectionResponse: QbdConnectorGet) => {
this.password = connectionResponse.password;
this.xmlFileContent = connectionResponse.qwc;
this.triggerManualDownload();
this.showDownloadLink = true;
});
this.isDownloadfileLoading = false;
});
this.isDownloadfileLoading = false;
this.isDownloadfileLoading = true;
this.isCompanyPathInvalid = false;
this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath}).subscribe((connectionResponse: QbdConnectorGet) => {
this.password = connectionResponse.password;
this.xmlFileContent = connectionResponse.qwc;
this.triggerManualDownload();
this.showDownloadLink = true;
this.isDownloadfileLoading = false;
});

Comment on lines 86 to 89
if(filePath) {
this.isDownloadfileLoading = true;
this.isCompanyPathInvalid = false;
this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath}).subscribe((connectionResponse: QbdConnectorGet) => {
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 basic path validation while maintaining simplicity

While simplifying the validation aligns with the requirements, consider adding basic sanity checks to prevent obvious issues:

-if(filePath) {
+if (filePath?.trim()) {
   this.isDownloadfileLoading = true;
   this.isCompanyPathInvalid = false;
-  this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath}).subscribe((connectionResponse: QbdConnectorGet) => {
+  this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath.trim()}).subscribe((connectionResponse: QbdConnectorGet) => {

Also, fix the spacing after if to maintain consistent code style.

📝 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
if(filePath) {
this.isDownloadfileLoading = true;
this.isCompanyPathInvalid = false;
this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath}).subscribe((connectionResponse: QbdConnectorGet) => {
if (filePath?.trim()) {
this.isDownloadfileLoading = true;
this.isCompanyPathInvalid = false;
this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath.trim()}).subscribe((connectionResponse: QbdConnectorGet) => {
🧰 Tools
🪛 eslint

[error] 86-86: Expected space(s) after "if".

(keyword-spacing)

Comment on lines +89 to +94
this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath}).subscribe((connectionResponse: QbdConnectorGet) => {
this.password = connectionResponse.password;
this.xmlFileContent = connectionResponse.qwc;
this.triggerManualDownload();
this.showDownloadLink = true;
});
this.isDownloadfileLoading = 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

Add error handling to API call

The API subscription lacks error handling, which could leave the UI in a loading state if an error occurs.

 this.qbdDirectConnectorService.postQbdDirectConntion({file_location: filePath}).subscribe(
-  (connectionResponse: QbdConnectorGet) => {
+  {
+   next: (connectionResponse: QbdConnectorGet) => {
     this.password = connectionResponse.password;
     this.xmlFileContent = connectionResponse.qwc;
     this.triggerManualDownload();
     this.showDownloadLink = true;
     this.isDownloadfileLoading = false;
+   },
+   error: (error) => {
+     this.isDownloadfileLoading = false;
+     this.toastService.displayToastMessage(ToastSeverity.ERROR, 'Failed to establish QuickBooks Desktop connection');
+   }
+ }
 );

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

@DhaaraniCIT DhaaraniCIT added the deploy Triggers deployment of active branch to Staging label Dec 12, 2024
Copy link

Unit Test Coverage % values
Statements 34% ( 4196 / 12339 )
Branches 27.52% ( 1204 / 4374 )
Functions 26.64% ( 921 / 3456 )
Lines 34.16% ( 4128 / 12083 )

@DhaaraniCIT DhaaraniCIT merged commit 2933601 into master Dec 12, 2024
7 checks passed
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Dec 12, 2024
* fix: remove validation temporarily (#1111)

* fix: add a default bank account field for CCC expenses

* fix: add missing options to bank accounts on page init

* fix: dynamic content for xero customize settings (#1112)

* fix: update sublabel key to avoid build fail (#1116)

* fix: Prod fixes of QBD direct (#1118)

* fix bugs (#1119)

* refactor: capitalization

* fix: only ccc exports not being saved (#1121)

---------

Co-authored-by: Ashwin Thanaraj <[email protected]>
Co-authored-by: Nilesh Pant <[email protected]>
Co-authored-by: Dhaarani <[email protected]>
Co-authored-by: Anish Kr Singh <[email protected]>
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Dec 12, 2024
* fix: restrict JE modules to group by expense only

* fix: add a default bank account field for CCC expenses (#1114)

* fix: remove validation temporarily (#1111)

* fix: add a default bank account field for CCC expenses

* fix: add missing options to bank accounts on page init

* fix: dynamic content for xero customize settings (#1112)

* fix: update sublabel key to avoid build fail (#1116)

* fix: Prod fixes of QBD direct (#1118)

* fix bugs (#1119)

* refactor: capitalization

* fix: only ccc exports not being saved (#1121)

---------

Co-authored-by: Ashwin Thanaraj <[email protected]>
Co-authored-by: Nilesh Pant <[email protected]>
Co-authored-by: Dhaarani <[email protected]>
Co-authored-by: Anish Kr Singh <[email protected]>

---------

Co-authored-by: Ashwin Thanaraj <[email protected]>
Co-authored-by: Nilesh Pant <[email protected]>
Co-authored-by: Dhaarani <[email protected]>
Co-authored-by: Anish Kr Singh <[email protected]>
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Dec 12, 2024
* fix: initialize chart of accounts multiselect when there is no api response (#1110)

* fix: remove the posted at date option for ccc expenses grouped by report (#1105)

* fix: update login error flow and fix redirect url (#1117)

* fix: restrict JE modules to group by expense only (#1113)

* fix: restrict JE modules to group by expense only

* fix: add a default bank account field for CCC expenses (#1114)

* fix: remove validation temporarily (#1111)

* fix: add a default bank account field for CCC expenses

* fix: add missing options to bank accounts on page init

* fix: dynamic content for xero customize settings (#1112)

* fix: update sublabel key to avoid build fail (#1116)

* fix: Prod fixes of QBD direct (#1118)

* fix bugs (#1119)

* refactor: capitalization

* fix: only ccc exports not being saved (#1121)

---------

Co-authored-by: Ashwin Thanaraj <[email protected]>
Co-authored-by: Nilesh Pant <[email protected]>
Co-authored-by: Dhaarani <[email protected]>
Co-authored-by: Anish Kr Singh <[email protected]>

---------

Co-authored-by: Ashwin Thanaraj <[email protected]>
Co-authored-by: Nilesh Pant <[email protected]>
Co-authored-by: Dhaarani <[email protected]>
Co-authored-by: Anish Kr Singh <[email protected]>

---------

Co-authored-by: Ashwin Thanaraj <[email protected]>
Co-authored-by: Nilesh Pant <[email protected]>
Co-authored-by: Dhaarani <[email protected]>
Co-authored-by: Anish Kr Singh <[email protected]>
DhaaraniCIT added a commit that referenced this pull request Dec 16, 2024
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