Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: qbd direct tracking for export and sync on click #1134

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/app/core/models/enum/enum.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ export enum TravelperkUpdateEvent {

export enum QbdDirectUpdateEvent {
CONFIRM_PRE_REQUISITES_QBD_DIRECT = 'Confirm Pre Requisites QuickBooks Desktop Connector',
CONNECT_QBD_DIRECT = 'Connect QuickBooks Desktop Connector',
PENDING_QWC_UPLOAD_QBD_DIRECT = 'Pending QWC Upload QuickBooks Desktop Connector',
DESTINATION_SYNC_COMPLETE_QBD_DIRECT = 'Destination Sync Complete QuickBooks Desktop Connector',
CONNECT_QBD_DIRECT = 'Step 2.1 - Connect QuickBooks Desktop Connector',
PENDING_QWC_UPLOAD_QBD_DIRECT = 'Step 2.2 - Upload QWC downloaded file to QuickBooks Desktop Connector',
DESTINATION_SYNC_COMPLETE_QBD_DIRECT = 'Step 2.3 - Sync destination entities with QuickBooks Desktop Connector',
EXPORT_SETTING_QBD_DIRECT = 'Export Settings QuickBooks Desktop Connector',
IMPORT_SETTINGS_QBD_DIRECT = 'Import Settings QuickBooks Desktop Connector',
ADVANCED_SETTINGS_QBD_DIRECT = 'Advanced Settings QuickBooks Desktop Connector',
Expand Down Expand Up @@ -165,7 +165,9 @@ export enum ClickEvent {
PREVIEW_INTACCT_EXPORT = 'Preview Sage Intacct Export',
INTACCT_EXPORT = 'Export Sage Intacct',
CONNECT_SAGE300 = 'Connect Sage 300 CRE',
CONNECT_BUSINESS_CENTRAL = 'Connect Dynamic 365 Business Central'
CONNECT_BUSINESS_CENTRAL = 'Connect Dynamic 365 Business Central',
QBD_DIRECT_EXPORT = 'Direct Export Quickbooks Desktop',
QBD_DIRECT_SYNC = 'Sync Quickbooks Desktop Direct'
Comment on lines +169 to +170
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

Maintain consistent naming conventions for enum values

The new enum values have inconsistent naming patterns compared to existing QuickBooks-related entries:

  1. "Quickbooks" should be "QuickBooks" (two words) to match existing entries
  2. Word order should follow the established pattern

Apply this diff to maintain consistency:

-  QBD_DIRECT_EXPORT = 'Direct Export Quickbooks Desktop',
-  QBD_DIRECT_SYNC = 'Sync Quickbooks Desktop Direct'
+  QBD_DIRECT_EXPORT = 'Export QuickBooks Desktop Direct',
+  QBD_DIRECT_SYNC = 'Sync QuickBooks Desktop Direct'
📝 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
QBD_DIRECT_EXPORT = 'Direct Export Quickbooks Desktop',
QBD_DIRECT_SYNC = 'Sync Quickbooks Desktop Direct'
QBD_DIRECT_EXPORT = 'Export QuickBooks Desktop Direct',
QBD_DIRECT_SYNC = 'Sync QuickBooks Desktop Direct'

}

export enum ProgressPhase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { ApiService } from '../../common/api.service';
import { WorkspaceService } from '../../common/workspace.service';
import { Observable } from 'rxjs';
import { IntegrationsToastService } from '../../common/integrations-toast.service';
import { ToastSeverity } from 'src/app/core/models/enum/enum.model';
import { ClickEvent, ToastSeverity, TrackingApp } from 'src/app/core/models/enum/enum.model';
import { TrackingService } from '../../integration/tracking.service';

@Injectable({
providedIn: 'root'
Expand All @@ -13,14 +14,16 @@ export class QbdDirectHelperService {
constructor(
private apiService: ApiService,
private workspaceService: WorkspaceService,
private toastService: IntegrationsToastService
private toastService: IntegrationsToastService,
private trackingService: TrackingService
) { }

importQBDAttributes(refresh: boolean): Observable<{}> {
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

Replace {} type with a more specific return type

Using {} as a return type is discouraged as it means "any non-nullable value". Consider defining a specific interface or type for the response.

- importQBDAttributes(refresh: boolean): Observable<{}> {
+ importQBDAttributes(refresh: boolean): Observable<void> {

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

🧰 Tools
🪛 Biome (1.9.4)

[error] 21-21: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

return this.apiService.post(`/workspaces/${this.workspaceService.getWorkspaceId()}/qbd/import_attributes/`, {refresh});
}

importAttributes(refresh: boolean): void {
this.trackingService.onClickEvent(TrackingApp.QBD_DIRECT, ClickEvent.QBD_DIRECT_SYNC);
this.workspaceService.importFyleAttributes(refresh).subscribe();
this.importQBDAttributes(refresh).subscribe();
this.toastService.displayToastMessage(ToastSeverity.SUCCESS, 'Syncing data dimensions from Quickbooks Desktop');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { brandingFeatureConfig } from 'src/app/branding/branding-config';
import { brandingConfig } from 'src/app/branding/c1-contents-config';
import { AccountingExportSummary, AccountingExportSummaryModel } from 'src/app/core/models/db/accounting-export-summary.model';
import { DestinationFieldMap, DashboardModel } from 'src/app/core/models/db/dashboard.model';
import { AccountingGroupedErrors, AccountingGroupedErrorStat, Error, ErrorResponse } from 'src/app/core/models/db/error.model';
import { AppName, AccountingErrorType, QbdDirectTaskLogType, ReimbursableImportState, CCCImportState, AppUrl, TaskLogState } from 'src/app/core/models/enum/enum.model';
import { AccountingGroupedErrors, AccountingGroupedErrorStat, ErrorResponse } from 'src/app/core/models/db/error.model';
import { AppName, AccountingErrorType, ReimbursableImportState, CCCImportState, AppUrl, TaskLogState, ClickEvent, TrackingApp } from 'src/app/core/models/enum/enum.model';
import { QbdDirectTaskResponse, QbdDirectTaskLog } from 'src/app/core/models/qbd-direct/db/qbd-direct-task-log.model';
import { QbdDirectImportSettingModel } from 'src/app/core/models/qbd-direct/qbd-direct-configuration/qbd-direct-import-settings.model';
import { AccountingExportService } from 'src/app/core/services/common/accounting-export.service';
import { DashboardService } from 'src/app/core/services/common/dashboard.service';
import { WorkspaceService } from 'src/app/core/services/common/workspace.service';
import { TrackingService } from 'src/app/core/services/integration/tracking.service';
import { QbdDirectExportSettingsService } from 'src/app/core/services/qbd-direct/qbd-direct-configuration/qbd-direct-export-settings.service';
import { QbdDirectImportSettingsService } from 'src/app/core/services/qbd-direct/qbd-direct-configuration/qbd-direct-import-settings.service';
import { SharedModule } from 'src/app/shared/shared.module';
Expand Down Expand Up @@ -83,12 +83,13 @@ export class QbdDirectDashboardComponent implements OnInit {
private accountingExportService: AccountingExportService,
private dashboardService: DashboardService,
private QbdDirectExportSettingsService: QbdDirectExportSettingsService,
private workspaceService: WorkspaceService,
private trackingService: TrackingService,
private importSettingService: QbdDirectImportSettingsService
) { }

export() {
this.isExportInProgress = true;
this.trackingService.onClickEvent(TrackingApp.QBD_DIRECT, ClickEvent.QBD_DIRECT_EXPORT);
this.dashboardService.triggerAccountingExport('v1').subscribe(() => {
this.pollExportStatus(this.exportableAccountingExportIds);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { Component, OnInit } from '@angular/core';
import { Router, RouterModule } from '@angular/router';
import { MenuItem } from 'primeng/api';
import { brandingContent, brandingFeatureConfig } from 'src/app/branding/branding-config';
import { AppName, ToastSeverity } from 'src/app/core/models/enum/enum.model';
import { IntegrationsToastService } from 'src/app/core/services/common/integrations-toast.service';
import { WorkspaceService } from 'src/app/core/services/common/workspace.service';
import { AppName } from 'src/app/core/models/enum/enum.model';
import { QbdDirectHelperService } from 'src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-helper.service';
import { SharedModule } from 'src/app/shared/shared.module';

Expand Down Expand Up @@ -35,9 +33,7 @@ export class QbdDirectMainComponent implements OnInit {

constructor(
private qbdDirectHelperService: QbdDirectHelperService,
private router: Router,
private toastService: IntegrationsToastService,
private workspaceService: WorkspaceService
private router: Router
) { }


Expand Down
Loading