-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
PR description must contain a link to a ClickUp (case-insensitive) |
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 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. ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (6)
WalkthroughThe changes involve modifications to several components related to dashboard error handling and mapping functionalities. A new property, Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
PR description must contain a link to a ClickUp (case-insensitive) |
There was a problem hiding this 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 trackingInstead of using console.log for debugging, consider:
- Using Angular's ErrorHandler for systematic error tracking
- Implementing a logging service that can be toggled based on environment
- 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
📒 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:
- What specific bugs are being addressed?
- How does this console.log help in fixing those bugs?
- 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
console.log(this.errorExpenses) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
There was a problem hiding this 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 propertyThe 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 detectionThe property could benefit from:
- Input validation to ensure valid account types
- 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 asundefined
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 asundefined
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 asundefined
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
📒 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
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
PR description must contain a link to a ClickUp (case-insensitive) |
There was a problem hiding this 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 pollExportStatusWhile 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
📒 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.
PR description must contain a link to a ClickUp (case-insensitive) |
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'" |
There was a problem hiding this comment.
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'" |
There was a problem hiding this comment.
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'" |
There was a problem hiding this comment.
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'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
PR description must contain a link to a ClickUp (case-insensitive) |
There was a problem hiding this 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
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.
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); }
- 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 stringWhile 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 conditionsThe HTML template uses the same string check as the TypeScript file. To improve maintainability:
- Use the same constant/enum suggested for the TypeScript file
- 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
📒 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
:
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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> |
There was a problem hiding this comment.
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:
- Remove the trailing space from
qbd-direct-onboarding-landing.component.html
- 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:
- The trailing space in the string seems like a fragile solution
- 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
PR description must contain a link to a ClickUp (case-insensitive) |
|
Description
fix: QBD direct bug fixes
Clickup
https://app.clickup.com
Summary by CodeRabbit
New Features
detailAccountType
, to enhance the handling of account types across various components.detailAccountType
in multiple components, improving data flow and flexibility.Bug Fixes
Documentation
Style