Skip to content

Commit

Permalink
Hide features for c1 (#465)
Browse files Browse the repository at this point in the history
* Hide features for c1

* fix lint

* update onboarding state

* fix

* fix
  • Loading branch information
ashwin1111 authored Jan 22, 2024
1 parent b370b94 commit f4ad5a8
Show file tree
Hide file tree
Showing 28 changed files with 142 additions and 58 deletions.
52 changes: 48 additions & 4 deletions src/app/branding/branding-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,60 @@ export const brandingConfig: BrandingConfiguration = config;

const featureConfigs: FeatureConfiguration = {
fyle: {
reimbursableExpenses: true,
illustrationsAllowed: true,
isGradientAllowed: true,
exposeOnlyQBOApp: false
exposeOnlyQBOApp: false,
featureFlags: {
cloneSettings: true,
mapEmployees: true,
exportSettings: {
reimbursableExpenses: true,
nameInJournalEntry: true
},
importSettings: {
tax: true
},
advancedSettings: {
autoCreateVendors: true,
paymentsSync: true,
singleCreditLineJE: true,
emailNotification: true
},
exportLog: {
expenseType: true
},
mappings: {
employeeMapping: true
}
}
},
co: {
reimbursableExpenses: true,
illustrationsAllowed: false,
isGradientAllowed: false,
exposeOnlyQBOApp: true
exposeOnlyQBOApp: true,
featureFlags: {
cloneSettings: false,
mapEmployees: false,
exportSettings: {
reimbursableExpenses: false,
nameInJournalEntry: false
},
importSettings: {
tax: false
},
advancedSettings: {
autoCreateVendors: false,
paymentsSync: false,
singleCreditLineJE: false,
emailNotification: false
},
exportLog: {
expenseType: false
},
mappings: {
employeeMapping: false
}
}
}
};

Expand Down
26 changes: 24 additions & 2 deletions src/app/core/models/branding/feature-configuration.model.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
export type FeatureConfiguration = {
[brandingId: string]: {
reimbursableExpenses: boolean;
illustrationsAllowed: boolean;
isGradientAllowed: boolean;
exposeOnlyQBOApp: boolean;
featureFlags: {
cloneSettings: boolean;
mapEmployees: boolean;
exportSettings: {
reimbursableExpenses: boolean;
nameInJournalEntry: boolean;
},
importSettings: {
tax: boolean;
},
advancedSettings: {
autoCreateVendors: boolean;
paymentsSync: boolean;
singleCreditLineJE: boolean;
emailNotification: boolean;
},
exportLog: {
expenseType: boolean;
},
mappings: {
employeeMapping: boolean;
}
}
}
}
}
1 change: 0 additions & 1 deletion src/app/core/models/misc/onboarding-stepper.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export type OnboardingStepper = {
active: boolean,
number: number,
completed: boolean,
step: string,
icon: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { QBOPaymentSyncDirection } from "../../enum/enum.model";
import { ExportSettingValidatorRule } from "../../common/export-settings.model";
import { AdvancedSettingValidatorRule, AdvancedSettingsModel } from "../../common/advanced-settings.model";
import { HelperUtility } from "../../common/helper.model";
import { brandingConfig } from "src/app/branding/branding-config";
import { brandingConfig, brandingFeatureConfig } from "src/app/branding/branding-config";


export type QBOAdvancedSettingWorkspaceGeneralSetting = {
Expand Down Expand Up @@ -119,7 +119,7 @@ export class QBOAdvancedSettingModel extends HelperUtility {
sync_qbo_to_fyle_payments: advancedSettingsForm.get('paymentSync')?.value && advancedSettingsForm.get('paymentSync')?.value === QBOPaymentSyncDirection.QBO_TO_FYLE ? true : false,
auto_create_destination_entity: advancedSettingsForm.get('autoCreateVendors')?.value,
auto_create_merchants_as_vendors: advancedSettingsForm.get('autoCreateMerchantsAsVendors')?.value,
je_single_credit_line: advancedSettingsForm.get('singleCreditLineJE')?.value,
je_single_credit_line: !brandingFeatureConfig.featureFlags.advancedSettings.singleCreditLineJE ? true : advancedSettingsForm.get('singleCreditLineJE')?.value,
change_accounting_period: advancedSettingsForm.get('changeAccountingPeriod')?.value,
memo_structure: advancedSettingsForm.get('memoStructure')?.value
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ExpenseGroupSettingGet, ExpenseGroupSettingPost } from "../../db/expens
import { SelectFormOption } from "../../common/select-form-option.model";
import { FormControl, FormGroup, Validators } from "@angular/forms";
import { ExportModuleRule, ExportSettingModel, ExportSettingValidatorRule } from "../../common/export-settings.model";
import { brandingFeatureConfig } from "src/app/branding/branding-config";

export type QBOExportSettingWorkspaceGeneralSettingPost = {
reimbursable_expenses_object: QBOReimbursableExpensesObject | null,
Expand Down Expand Up @@ -253,6 +254,14 @@ export class QBOExportSettingModel extends ExportSettingModel {

static constructPayload(exportSettingsForm: FormGroup): QBOExportSettingPost {
const emptyDestinationAttribute: DefaultDestinationAttribute = {id: null, name: null};
let nameInJournalEntry = NameInJournalEntry.EMPLOYEE;

if (!brandingFeatureConfig.featureFlags.exportSettings.nameInJournalEntry) {
nameInJournalEntry = NameInJournalEntry.MERCHANT;
} else {
nameInJournalEntry = exportSettingsForm.get('nameInJournalEntry')?.value;
}

const exportSettingPayload: QBOExportSettingPost = {
expense_group_settings: {
expense_state: exportSettingsForm.get('expenseState')?.value,
Expand All @@ -265,7 +274,7 @@ export class QBOExportSettingModel extends ExportSettingModel {
workspace_general_settings: {
reimbursable_expenses_object: exportSettingsForm.get('reimbursableExportType')?.value,
corporate_credit_card_expenses_object: exportSettingsForm.get('creditCardExportType')?.value,
name_in_journal_entry: exportSettingsForm.get('creditCardExportType')?.value === QBOCorporateCreditCardExpensesObject.JOURNAL_ENTRY ? exportSettingsForm.get('nameInJournalEntry')?.value : NameInJournalEntry.EMPLOYEE
name_in_journal_entry: nameInJournalEntry
},
general_mappings: {
bank_account: exportSettingsForm.get('bankAccount')?.value ? exportSettingsForm.get('bankAccount')?.value : emptyDestinationAttribute,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { brandingFeatureConfig } from "src/app/branding/branding-config";
import { QBOOnboardingState } from "../../enum/enum.model";
import { OnboardingStepper } from "../../misc/onboarding-stepper.model";

Expand All @@ -12,11 +13,10 @@ type QBOOnboardingStepperMap = {
}

export class QBOOnboardingModel {
private readonly onboardingSteps: OnboardingStepper[] = [
private onboardingSteps: OnboardingStepper[] = [
{
active: false,
completed: false,
number: 1,
step: 'Connect to QuickBooks Online',
icon: 'connector',
route: '/integrations/qbo/onboarding/connector',
Expand All @@ -29,7 +29,6 @@ export class QBOOnboardingModel {
{
active: false,
completed: false,
number: 2,
step: 'Map Employees',
icon: 'export-setting',
route: '/integrations/qbo/onboarding/employee_settings',
Expand All @@ -42,7 +41,6 @@ export class QBOOnboardingModel {
{
active: false,
completed: false,
number: 3,
step: 'Export Settings',
icon: 'export-setting',
route: '/integrations/qbo/onboarding/export_settings',
Expand All @@ -55,7 +53,6 @@ export class QBOOnboardingModel {
{
active: false,
completed: false,
number: 4,
step: 'Import Settings',
icon: 'export-setting',
route: '/integrations/qbo/onboarding/import_settings',
Expand All @@ -68,7 +65,6 @@ export class QBOOnboardingModel {
{
active: false,
completed: false,
number: 5,
step: 'Advanced Settings',
icon: 'advanced-setting',
route: '/integrations/qbo/onboarding/advanced_settings',
Expand Down Expand Up @@ -103,6 +99,10 @@ export class QBOOnboardingModel {
this.onboardingSteps[index - 1].completed = true;
}

if (!brandingFeatureConfig.featureFlags.mapEmployees) {
this.onboardingSteps.splice(1, 1);
}

return this.onboardingSteps;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export class BusinessCentralOnboardingService {
{
active: false,
completed: false,
number: 1,
step: 'Connect to Dynamics \n 365 Business Central',
icon: 'connector',
route: '/integrations/business_central/onboarding/connector',
Expand All @@ -35,7 +34,6 @@ export class BusinessCentralOnboardingService {
{
active: false,
completed: false,
number: 2,
step: 'Export Settings',
icon: 'export-setting',
route: '/integrations/business_central/onboarding/export_settings',
Expand All @@ -48,7 +46,6 @@ export class BusinessCentralOnboardingService {
{
active: false,
completed: false,
number: 3,
step: 'Import Settings',
icon: 'import-setting',
route: '/integrations/business_central/onboarding/import_settings',
Expand All @@ -61,7 +58,6 @@ export class BusinessCentralOnboardingService {
{
active: false,
completed: false,
number: 4,
step: 'Advanced Settings',
icon: 'advanced-setting',
route: '/integrations/business_central/onboarding/advanced_settings',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export class Sage300OnboardingService {
{
active: false,
completed: false,
number: 1,
step: 'Connect to Sage 300 CRE',
icon: 'connector',
route: '/integrations/sage300/onboarding/connector',
Expand All @@ -34,7 +33,6 @@ export class Sage300OnboardingService {
{
active: false,
completed: false,
number: 2,
step: 'Export Settings',
icon: 'export-setting',
route: '/integrations/sage300/onboarding/export_settings',
Expand All @@ -47,7 +45,6 @@ export class Sage300OnboardingService {
{
active: false,
completed: false,
number: 3,
step: 'Import Settings',
icon: 'import-setting',
route: '/integrations/sage300/onboarding/import_settings',
Expand All @@ -60,7 +57,6 @@ export class Sage300OnboardingService {
{
active: false,
completed: false,
number: 4,
step: 'Advanced Settings',
icon: 'advanced-setting',
route: '/integrations/sage300/onboarding/advanced_settings',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export class QboConfigurationComponent implements OnInit {
constructor() { }

ngOnInit(): void {
if (!brandingFeatureConfig.featureFlags.mapEmployees) {
this.modules.splice(0, 1);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export class QboMappingComponent implements OnInit {
}
});
}
if (!brandingFeatureConfig.featureFlags.mapEmployees) {
this.mappingPages.splice(0, 1);
}
this.router.navigateByUrl(this.mappingPages[0].routerLink);
this.isLoading = false;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ export class QboCloneSettingsComponent implements OnInit {
this.onboardingSteps.push({
active: false,
completed: false,
number: 6,
step: 'Clone Settings',
icon: 'advanced-setting',
route: '/integrations/qbo/onboarding/clone_settings',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ConfirmEventType } from 'primeng/api';
import { Subscription } from 'rxjs';
import { brandingConfig, brandingKbArticles } from 'src/app/branding/branding-config';
import { brandingConfig, brandingFeatureConfig, brandingKbArticles } from 'src/app/branding/branding-config';
import { BrandingConfiguration } from 'src/app/core/models/branding/branding-configuration.model';
import { CloneSettingExist } from 'src/app/core/models/common/clone-setting.model';
import { ConfigurationCta, ConfigurationWarningEvent, QBOOnboardingState, ToastSeverity } from 'src/app/core/models/enum/enum.model';
Expand Down Expand Up @@ -102,7 +102,11 @@ export class QboOnboardingConnectorComponent implements OnInit, OnDestroy {
return;
}

this.checkCloneSettingsAvailablity();
if (!brandingFeatureConfig.featureFlags.cloneSettings) {
this.router.navigate(['/integrations/qbo/onboarding/export_settings']);
} else {
this.checkCloneSettingsAvailablity();
}
}

acceptWarning(data: ConfigurationWarningOut): void {
Expand Down Expand Up @@ -159,7 +163,12 @@ export class QboOnboardingConnectorComponent implements OnInit, OnDestroy {
}

private handlePostQBOConnection(qboCredential: QBOCredential): void {
this.workspaceService.setOnboardingState(QBOOnboardingState.MAP_EMPLOYEES);
if (brandingFeatureConfig.featureFlags.mapEmployees) {
this.workspaceService.setOnboardingState(QBOOnboardingState.MAP_EMPLOYEES);
} else {
this.workspaceService.setOnboardingState(QBOOnboardingState.EXPORT_SETTINGS);
}

this.qboConnectionInProgress = false;
this.qboCompanyName = qboCredential.company_name;
this.isQboConnected = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
[label]="'Set up export frequency'"
[subLabel]="'Set a frequency based on how often you want your expenses in ' + brandingConfig.brandName + ' to be exported to QuickBooks Online'"
[options]="hours"
[isEmailPresent]="true"
[isEmailPresent]="brandingFeatureConfig.featureFlags.advancedSettings.emailNotification ? true: false"
[formControllerName]="'exportScheduleFrequency'"
[adminEmails]="adminEmails">
</app-configuration-schedule-export>
Expand All @@ -62,15 +62,15 @@
[formControllerName]="'changeAccountingPeriod'">
</app-configuration-toggle-field>

<app-configuration-toggle-field *ngIf="isAutoCreateVendorsFieldVisible()"
<app-configuration-toggle-field *ngIf="isAutoCreateVendorsFieldVisible() && brandingFeatureConfig.featureFlags.advancedSettings.autoCreateVendors"
[form]="advancedSettingForm"
[iconPath]="'building'"
[label]="'Auto-Create Vendors'"
[subLabel]="'While exporting reimbursable expenses from ' + brandingConfig.brandName + ', the integration will automatically create a vendor if a match does not exist in QuickBooks Online already.'"
[formControllerName]="'autoCreateVendors'">
</app-configuration-toggle-field>

<app-configuration-select-field *ngIf="isPaymentSyncFieldVisible()"
<app-configuration-select-field *ngIf="isPaymentSyncFieldVisible() && brandingFeatureConfig.featureFlags.advancedSettings.paymentsSync"
[form]="advancedSettingForm"
[options]="paymentSyncOptions"
[iconPath]="'synced'"
Expand All @@ -92,7 +92,7 @@
[formControllerName]="'billPaymentAccount'">
</app-configuration-select-field>

<app-configuration-toggle-field *ngIf="isSingleCreditLineJEFieldVisible()"
<app-configuration-toggle-field *ngIf="isSingleCreditLineJEFieldVisible() && brandingFeatureConfig.featureFlags.advancedSettings.singleCreditLineJE"
[form]="advancedSettingForm"
[iconPath]="'list'"
[label]="'Create a single itemized offset credit entry for Journal'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { forkJoin } from 'rxjs';
import { brandingConfig, brandingKbArticles } from 'src/app/branding/branding-config';
import { brandingConfig, brandingFeatureConfig, brandingKbArticles } from 'src/app/branding/branding-config';
import { AdvancedSettingsModel, ConditionField, EmailOption, ExpenseFilterPayload, ExpenseFilterResponse, SkipExportModel, SkipExportValidatorRule, skipExportValidator } from 'src/app/core/models/common/advanced-settings.model';
import { SelectFormOption } from 'src/app/core/models/common/select-form-option.model';
import { DefaultDestinationAttribute, DestinationAttribute } from 'src/app/core/models/db/destination-attribute.model';
Expand Down Expand Up @@ -73,6 +73,8 @@ export class QboAdvancedSettingsComponent implements OnInit {

ConfigurationCtaText = ConfigurationCta;

readonly brandingFeatureConfig = brandingFeatureConfig;

constructor(
private advancedSettingsService: QboAdvancedSettingsService,
private configurationService: ConfigurationService,
Expand Down
Loading

0 comments on commit f4ad5a8

Please sign in to comment.