Skip to content

Commit

Permalink
Merge branch 'master' into move-emp-settings-to-export-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
anishfyle committed Dec 17, 2024
2 parents 7c13382 + 0e74697 commit ff7e00d
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 17 deletions.
15 changes: 15 additions & 0 deletions src/app/core/models/enum/enum.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ export enum TravelperkUpdateEvent {
ADVANCED_SETTINGS_TRAVELPERK = 'Advanced Settings TravelPerk',
}

export enum QbdDirectUpdateEvent {
CONFIRM_PRE_REQUISITES_QBD_DIRECT = 'Confirm Pre Requisites QuickBooks Desktop Connector',
CONNECT_QBD_DIRECT = 'Connect QuickBooks Desktop Connector',
PENDING_QWC_UPLOAD_QBD_DIRECT = 'Pending QWC Upload QuickBooks Desktop Connector',
DESTINATION_SYNC_COMPLETE_QBD_DIRECT = 'Destination Sync Complete 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',
}

export enum AppName {
BAMBOO_HR = 'BambooHR',
QBD = 'QuickBooks Desktop',
Expand Down Expand Up @@ -126,6 +136,11 @@ export enum Page {
ADVANCED_SETTINGS_BUSINESS_CENTRAL = 'Advanced Settings BusinessCentral',
PAYMENT_PROFILE_SETTINGS_TRAVELPERK = 'Payment Profile Settings TravelPerk',
ADVANCED_SETTINGS_TRAVELPERK = 'Advanced Settings TravelPerk',
EXPORT_SETTING_QBD_DIRECT = 'Export Settings QuickBooks Desktop Connector',
CONNECT_QBD_DIRECT = 'Connect QuickBooks Desktop Connector',
CONFIRM_PRE_REQUISITES_QBD_DIRECT = 'Confirm Pre Requisites QuickBooks Desktop Connector',
IMPORT_SETTINGS_QBD_DIRECT = 'Import Settings QuickBooks Desktop Connector',
ADVANCED_SETTINGS_QBD_DIRECT = 'Advanced Settings QuickBooks Desktop Connector',
}

export enum ClickEvent {
Expand Down
8 changes: 6 additions & 2 deletions src/app/core/models/misc/tracking.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ import { TravelperkPaymentProfileSettingResponse } from "../travelperk/travelper
import { AdvancedSettingsGet } from "../intacct/intacct-configuration/advanced-settings.model";
import { ExportSettingGet } from "../intacct/intacct-configuration/export-settings.model";
import { ImportSettingGet, ImportSettings } from "../intacct/intacct-configuration/import-settings.model";
import { QbdDirectAdvancedSettingsPost } from "../qbd-direct/qbd-direct-configuration/qbd-direct-advanced-settings.model";
import { QbdDirectExportSettingsPost } from "../qbd-direct/qbd-direct-configuration/qbd-direct-export-settings.model";
import { QbdDirectImportSettingPost } from "../qbd-direct/qbd-direct-configuration/qbd-direct-import-settings.model";
import { Workspace } from "../db/workspaces.model";

export type UpdateEventAdditionalProperty = {
phase: ProgressPhase,
oldState: QBDAdvancedSettingsGet | QBDExportSettingGet | QBDFieldMappingGet | Sage300ExportSettingGet | Sage300ImportSettingGet | Sage300AdvancedSettingGet | null | BusinessCentralExportSettingGet | BusinessCentralImportSettingsGet | BusinessCentralAdvancedSettingsGet | TravelperkPaymentProfileSettingResponse | TravelperkAdvancedSettingPost,
newState: QBDAdvancedSettingsGet | QBDExportSettingGet | QBDFieldMappingGet | Sage300ExportSettingGet | Sage300ImportSettingGet | Sage300AdvancedSettingGet | BusinessCentralExportSettingGet | BusinessCentralImportSettingsGet | BusinessCentralAdvancedSettingsGet | TravelperkPaymentProfileSettingResponse | TravelperkAdvancedSettingPost
oldState: QBDAdvancedSettingsGet | QBDExportSettingGet | QBDFieldMappingGet | Sage300ExportSettingGet | Sage300ImportSettingGet | Sage300AdvancedSettingGet | null | BusinessCentralExportSettingGet | BusinessCentralImportSettingsGet | BusinessCentralAdvancedSettingsGet | TravelperkPaymentProfileSettingResponse | TravelperkAdvancedSettingPost | QbdDirectExportSettingsPost | QbdDirectImportSettingPost | QbdDirectAdvancedSettingsPost | Workspace,
newState: QBDAdvancedSettingsGet | QBDExportSettingGet | QBDFieldMappingGet | Sage300ExportSettingGet | Sage300ImportSettingGet | Sage300AdvancedSettingGet | BusinessCentralExportSettingGet | BusinessCentralImportSettingsGet | BusinessCentralAdvancedSettingsGet | TravelperkPaymentProfileSettingResponse | TravelperkAdvancedSettingPost | QbdDirectExportSettingsPost | QbdDirectImportSettingPost | QbdDirectAdvancedSettingsPost | Workspace
};

export type UpdateIntacctEventAdditionalProperty = {
Expand Down
9 changes: 6 additions & 3 deletions src/app/core/services/integration/tracking.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { BusinessCentralOnboardingState, NetsuiteOnboardingState, BusinessCentralUpdateEvent, ClickEvent, IntacctOnboardingState, IntacctUpdateEvent, Page, QBDOnboardingState, Sage300OnboardingState, Sage300UpdateEvent, TrackingApp, TravelPerkOnboardingState, TravelperkUpdateEvent, UpdateEvent } from '../../models/enum/enum.model';
import { BusinessCentralOnboardingState, NetsuiteOnboardingState, BusinessCentralUpdateEvent, ClickEvent, IntacctOnboardingState, IntacctUpdateEvent, Page, QBDOnboardingState, Sage300OnboardingState, Sage300UpdateEvent, TrackingApp, TravelPerkOnboardingState, TravelperkUpdateEvent, UpdateEvent, QbdDirectOnboardingState, QbdDirectUpdateEvent } from '../../models/enum/enum.model';
import { MappingAlphabeticalFilterAdditionalProperty, ResolveMappingErrorProperty, UpdateEventAdditionalProperty, UpdateIntacctEventAdditionalProperty } from '../../models/misc/tracking.model';
import { QBDAdvancedSettingsPost } from '../../models/qbd/qbd-configuration/qbd-advanced-setting.model';
import { QBDExportSettingPost } from '../../models/qbd/qbd-configuration/qbd-export-setting.model';
Expand All @@ -17,6 +17,9 @@ import { BusinessCentralAdvancedSettingsPost } from '../../models/business-centr
import { NetsuiteSubsidiaryMappingPost } from '../../models/netsuite/netsuite-configuration/netsuite-connector.model';
import { TravelperkPaymentProfileSettingPost } from '../../models/travelperk/travelperk-configuration/travelperk-payment-profile-settings.model';
import { TravelperkAdvancedSettingPost } from '../../models/travelperk/travelperk-configuration/travelperk-advanced-settings.model';
import { QbdDirectAdvancedSettingsPost } from '../../models/qbd-direct/qbd-direct-configuration/qbd-direct-advanced-settings.model';
import { QbdDirectExportSettingsPost } from '../../models/qbd-direct/qbd-direct-configuration/qbd-direct-export-settings.model';
import { QbdDirectImportSettingPost } from '../../models/qbd-direct/qbd-direct-configuration/qbd-direct-import-settings.model';

@Injectable({
providedIn: 'root'
Expand Down Expand Up @@ -100,11 +103,11 @@ export class TrackingService {
this.eventTrack(`Step ${stepNumber} completed: ${eventName}`, trackingApp, additionalProperties);
}

integrationsOnboardingCompletion(trackingApp: TrackingApp, eventName: IntacctOnboardingState | NetsuiteOnboardingState, stepNumber: number, additionalProperties: LocationEntityPost | ExportSettingPost | ImportSettingPost | AdvancedSettingsPost | NetsuiteSubsidiaryMappingPost | void): void {
integrationsOnboardingCompletion(trackingApp: TrackingApp, eventName: IntacctOnboardingState | NetsuiteOnboardingState | QbdDirectOnboardingState, stepNumber: number, additionalProperties: LocationEntityPost | ExportSettingPost | ImportSettingPost | AdvancedSettingsPost | NetsuiteSubsidiaryMappingPost | QbdDirectExportSettingsPost | QbdDirectImportSettingPost | QbdDirectAdvancedSettingsPost | void): void {
this.eventTrack(`Step ${stepNumber} completed: ${eventName}`, trackingApp, additionalProperties);
}

onUpdateEvent(trackingApp: TrackingApp, eventName: UpdateEvent | Sage300UpdateEvent | BusinessCentralUpdateEvent | TravelperkUpdateEvent, additionalProperties: Partial<UpdateEventAdditionalProperty> | void): void {
onUpdateEvent(trackingApp: TrackingApp, eventName: UpdateEvent | Sage300UpdateEvent | BusinessCentralUpdateEvent | TravelperkUpdateEvent | QbdDirectUpdateEvent, additionalProperties: Partial<UpdateEventAdditionalProperty> | void): void {
this.eventTrack(`Update event: ${eventName}`, trackingApp, additionalProperties);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { QbdDirectSharedModule } from '../../qbd-direct-shared/qbd-direct-shared
import { SharedModule } from 'src/app/shared/shared.module';
import { brandingConfig, brandingContent, brandingKbArticles } from 'src/app/branding/branding-config';
import { BrandingConfiguration } from 'src/app/core/models/branding/branding-configuration.model';
import { AppName, ConfigurationCta, QBDConnectionStatus, QbdDirectOnboardingState, QBDOnboardingState, ToastSeverity } from 'src/app/core/models/enum/enum.model';
import { AppName, ConfigurationCta, Page, ProgressPhase, QBDConnectionStatus, QbdDirectOnboardingState, QbdDirectUpdateEvent, QBDOnboardingState, ToastSeverity, TrackingApp } from 'src/app/core/models/enum/enum.model';
import { OnboardingStepper } from 'src/app/core/models/misc/onboarding-stepper.model';
import { QbdDirectOnboardingModel } from 'src/app/core/models/qbd-direct/qbd-direct-configuration/qbd-direct-onboarding.model';
import { Router } from '@angular/router';
Expand All @@ -18,6 +18,7 @@ import { interval, switchMap, from, takeWhile } from 'rxjs';
import { QbdDirectTaskResponse } from 'src/app/core/models/qbd-direct/db/qbd-direct-task-log.model';
import { IntegrationsToastService } from 'src/app/core/services/common/integrations-toast.service';
import { CheckBoxUpdate } from 'src/app/core/models/common/helper.model';
import { TrackingService } from 'src/app/core/services/integration/tracking.service';

@Component({
selector: 'app-qbd-direct-onboarding-connector',
Expand Down Expand Up @@ -74,12 +75,17 @@ export class QbdDirectOnboardingConnectorComponent implements OnInit {

appName: string = AppName.QBD_DIRECT;

sessionStartTime: Date = new Date();

workspace: QbdDirectWorkspace;

constructor(
private router: Router,
private workspaceService: WorkspaceService,
private storageService: StorageService,
private qbdDirectConnectorService: QbdDirectConnectorService,
private toastService: IntegrationsToastService
private toastService: IntegrationsToastService,
private trackingService: TrackingService
) { }

triggerDownload(filePath: string) {
Expand Down Expand Up @@ -112,6 +118,22 @@ export class QbdDirectOnboardingConnectorComponent implements OnInit {
proceedToConnection() {
this.isDownloadfileLoading = true;
this.workspaceService.updateWorkspaceOnboardingState({onboarding_state: QbdDirectOnboardingState.PENDING_QWC_UPLOAD}).subscribe((workspaceResponse: QbdDirectWorkspace) => {
this.workspace = workspaceResponse;
if (this.workspaceService.getOnboardingState() === QbdDirectOnboardingState.CONNECTION) {
this.trackingService.integrationsOnboardingCompletion(TrackingApp.QBD_DIRECT, QbdDirectOnboardingState.CONNECTION, 2);
} else {
const oldWorkspaceResponse = workspaceResponse;
oldWorkspaceResponse.onboarding_state = QbdDirectOnboardingState.CONNECTION;
this.trackingService.onUpdateEvent(
TrackingApp.QBD_DIRECT,
QbdDirectUpdateEvent.CONNECT_QBD_DIRECT,
{
phase: ProgressPhase.ONBOARDING,
oldState: oldWorkspaceResponse,
newState: workspaceResponse
}
);
}
this.isDownloadStepCompleted = true;
this.isDownloadfileLoading = false;
});
Expand Down Expand Up @@ -189,6 +211,21 @@ export class QbdDirectOnboardingConnectorComponent implements OnInit {
} else {
this.handleDataSyncState(workspaceResponse[0]);
}
if (workspaceResponse[0].onboarding_state in [QbdDirectOnboardingState.DESTINATION_SYNC_IN_PROGRESS, QbdDirectOnboardingState.DESTINATION_SYNC_COMPLETE]) {
this.trackingService.integrationsOnboardingCompletion(TrackingApp.QBD_DIRECT, QbdDirectOnboardingState.PENDING_QWC_UPLOAD, 2);
} else {
const oldWorkspaceResponse = this.workspace;
oldWorkspaceResponse.onboarding_state = QbdDirectOnboardingState.PENDING_QWC_UPLOAD;
this.trackingService.onUpdateEvent(
TrackingApp.QBD_DIRECT,
QbdDirectUpdateEvent.PENDING_QWC_UPLOAD_QBD_DIRECT,
{
phase: ProgressPhase.ONBOARDING,
oldState: oldWorkspaceResponse,
newState: workspaceResponse[0]
}
);
}
});
}

Expand Down Expand Up @@ -216,6 +253,22 @@ export class QbdDirectOnboardingConnectorComponent implements OnInit {
proceedToExportSetting() {
this.isLoading = true;
this.workspaceService.updateWorkspaceOnboardingState({onboarding_state: QbdDirectOnboardingState.EXPORT_SETTINGS}).subscribe((workspaceResponse: QbdDirectWorkspace) => {
this.trackingService.trackTimeSpent(TrackingApp.QBD_DIRECT, Page.CONNECT_QBD_DIRECT, this.sessionStartTime);
if (this.workspaceService.getOnboardingState() === QbdDirectOnboardingState.DESTINATION_SYNC_COMPLETE) {
this.trackingService.integrationsOnboardingCompletion(TrackingApp.QBD_DIRECT, QbdDirectOnboardingState.DESTINATION_SYNC_COMPLETE, 2);
} else {
const oldWorkspaceResponse = workspaceResponse;
oldWorkspaceResponse.onboarding_state = QbdDirectOnboardingState.DESTINATION_SYNC_COMPLETE;
this.trackingService.onUpdateEvent(
TrackingApp.QBD_DIRECT,
QbdDirectUpdateEvent.DESTINATION_SYNC_COMPLETE_QBD_DIRECT,
{
phase: ProgressPhase.ONBOARDING,
oldState: oldWorkspaceResponse,
newState: workspaceResponse
}
);
}
this.workspaceService.setOnboardingState(workspaceResponse.onboarding_state);
this.router.navigate([`/integrations/qbd_direct/onboarding/export_settings`]);
this.isLoading = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { brandingContent, brandingKbArticles } from 'src/app/branding/branding-c
import { brandingConfig } from 'src/app/branding/c1-contents-config';
import { BrandingConfiguration } from 'src/app/core/models/branding/branding-configuration.model';
import { CheckBoxUpdate } from 'src/app/core/models/common/helper.model';
import { AppName, ConfigurationCta, QbdDirectOnboardingState, QBDPreRequisiteState } from 'src/app/core/models/enum/enum.model';
import { AppName, ConfigurationCta, Page, ProgressPhase, QbdDirectOnboardingState, QbdDirectUpdateEvent, QBDPreRequisiteState, TrackingApp } from 'src/app/core/models/enum/enum.model';
import { OnboardingStepper } from 'src/app/core/models/misc/onboarding-stepper.model';
import { QbdDirectWorkspace } from 'src/app/core/models/qbd-direct/db/qbd-direct-workspaces.model';
import { QBDPrerequisiteObject } from 'src/app/core/models/qbd-direct/qbd-direct-configuration/qbd-direct-connector.model';
import { QbdDirectOnboardingModel } from 'src/app/core/models/qbd-direct/qbd-direct-configuration/qbd-direct-onboarding.model';
import { WorkspaceService } from 'src/app/core/services/common/workspace.service';
import { TrackingService } from 'src/app/core/services/integration/tracking.service';
import { SharedModule } from 'src/app/shared/shared.module';

@Component({
Expand Down Expand Up @@ -61,9 +62,12 @@ export class QbdDirectOnboardingPreRequisiteComponent {

qbdPreRequisiteState = QBDPreRequisiteState;

sessionStartTime: Date = new Date();

constructor(
private router: Router,
private workspaceService: WorkspaceService
private workspaceService: WorkspaceService,
private trackingService: TrackingService
) { }

updateConnectorStatus(status: CheckBoxUpdate): void {
Expand All @@ -76,6 +80,22 @@ export class QbdDirectOnboardingPreRequisiteComponent {
continueToNextStep(): void{
this.saveInProgress = true;
this.workspaceService.updateWorkspaceOnboardingState({onboarding_state: QbdDirectOnboardingState.CONNECTION}).subscribe((workspaceResponse: QbdDirectWorkspace) => {
this.trackingService.trackTimeSpent(TrackingApp.QBD_DIRECT, Page.CONFIRM_PRE_REQUISITES_QBD_DIRECT, this.sessionStartTime);
if (this.workspaceService.getOnboardingState() === QbdDirectOnboardingState.CONFIRM_PRE_REQUISITES) {
this.trackingService.integrationsOnboardingCompletion(TrackingApp.QBD_DIRECT, QbdDirectOnboardingState.CONFIRM_PRE_REQUISITES, 1);
} else {
const oldWorkspaceResponse = workspaceResponse;
oldWorkspaceResponse.onboarding_state = QbdDirectOnboardingState.CONFIRM_PRE_REQUISITES;
this.trackingService.onUpdateEvent(
TrackingApp.QBD_DIRECT,
QbdDirectUpdateEvent.CONFIRM_PRE_REQUISITES_QBD_DIRECT,
{
phase: ProgressPhase.ONBOARDING,
oldState: oldWorkspaceResponse,
newState: workspaceResponse
}
);
}
this.workspaceService.setOnboardingState(workspaceResponse.onboarding_state);
this.saveInProgress = false;
this.router.navigate([`/integrations/qbd_direct/onboarding/connector`]);
Expand Down
Loading

0 comments on commit ff7e00d

Please sign in to comment.