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: branding based conditions to feature flag #1179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/app/auth/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { StorageService } from 'src/app/core/services/common/storage.service';
import { NetsuiteAuthService } from 'src/app/core/services/netsuite/netsuite-core/netsuite-auth.service';
import { XeroAuthService } from 'src/app/core/services/xero/xero-core/xero-auth.service';
import { exposeAppConfig } from 'src/app/branding/expose-app-config';
import { brandingConfig } from 'src/app/branding/branding-config';
import { brandingConfig, brandingFeatureConfig } from 'src/app/branding/branding-config';
import { QbdDirectAuthService } from 'src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-auth.service';

@Component({
Expand Down Expand Up @@ -51,7 +51,7 @@ export class LoginComponent implements OnInit {

private redirect(redirectUri: string | undefined, code:string): void {
if (redirectUri) {
brandingConfig.brandId === 'co' ? this.router.navigate([redirectUri], { queryParams: { code: code } }) : this.router.navigate([redirectUri]);
brandingFeatureConfig.loginRedirectUri ? this.router.navigate([redirectUri], { queryParams: { code: code } }) : this.router.navigate([redirectUri]);
} else {
this.router.navigate(['/integrations']);
}
Expand Down
21 changes: 18 additions & 3 deletions src/app/branding/c1-branding-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,25 @@ export const c1FeatureConfig: FeatureConfiguration[string] = {
isBackgroundColorAllowed: true,
isAsterikAllowed: false,
allowIntacctHelperDoc: false,
loginRedirectUri: true,
featureFlags: {
cloneSettings: false,
mapEmployees: false,
c1Icon: true,
c1Options: true,
allowForC1: true,
exportSettings: {
reimbursableExpenses: false,
nameInJournalEntry: false,
useMerchantInJournalLine: false,
splitExpenseGrouping: false
splitExpenseGrouping: false,
cccDateConfiguration: true,
isEmployeeMappingIsEmployee: false,
sentenseCaseConversion: true,
cccExportGroupConfiguration: true,
lowerCaseConversion: true,
allowAccountsPayableInCoCCC: true,
allowBankAccountInCoCCC: true
},
importSettings: {
tax: false,
Expand All @@ -31,7 +42,10 @@ export const c1FeatureConfig: FeatureConfiguration[string] = {
importProjects: true,
allowCustomSegment: false,
dependentField: true,
allowImportCode: false
allowImportCode: false,
categoryImportEnabled: false,
intacctC1ImportSettings: true,
disableCustomerSourceField: true
},
advancedSettings: {
autoCreateVendors: false,
Expand All @@ -42,7 +56,8 @@ export const c1FeatureConfig: FeatureConfiguration[string] = {
skipExport: false,
autoCreateContacts: false,
useEmployeeAttributes: true,
autoCreateMerchants: true
autoCreateMerchants: true,
excludeCardNumberAndEmployeeNameInMemo: true
},
exportLog: {
expenseType: false
Expand Down
21 changes: 18 additions & 3 deletions src/app/branding/fyle-branding-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,25 @@ export const fyleFeatureConfig: FeatureConfiguration[string] = {
isBackgroundColorAllowed: false,
isAsterikAllowed: true,
allowIntacctHelperDoc: true,
loginRedirectUri: false,
featureFlags: {
cloneSettings: true,
mapEmployees: true,
c1Icon: false,
c1Options: false,
allowForC1: false,
exportSettings: {
reimbursableExpenses: true,
nameInJournalEntry: true,
useMerchantInJournalLine: true,
splitExpenseGrouping: true
splitExpenseGrouping: true,
cccDateConfiguration: true,
isEmployeeMappingIsEmployee: true,
sentenseCaseConversion: false,
cccExportGroupConfiguration: false,
lowerCaseConversion: false,
allowAccountsPayableInCoCCC: false,
allowBankAccountInCoCCC: false
},
importSettings: {
tax: true,
Expand All @@ -31,7 +42,10 @@ export const fyleFeatureConfig: FeatureConfiguration[string] = {
importProjects: true,
allowCustomSegment: true,
dependentField: true,
allowImportCode: true
allowImportCode: true,
categoryImportEnabled: true,
intacctC1ImportSettings: false,
disableCustomerSourceField: false
},
advancedSettings: {
autoCreateVendors: true,
Expand All @@ -42,7 +56,8 @@ export const fyleFeatureConfig: FeatureConfiguration[string] = {
skipExport: true,
autoCreateContacts: true,
useEmployeeAttributes: true,
autoCreateMerchants: true
autoCreateMerchants: true,
excludeCardNumberAndEmployeeNameInMemo: false
},
exportLog: {
expenseType: true
Expand Down
15 changes: 15 additions & 0 deletions src/app/core/models/branding/feature-configuration.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,25 @@ export type FeatureConfiguration = {
isBackgroundColorAllowed: boolean;
isAsterikAllowed: boolean;
allowIntacctHelperDoc: boolean;
loginRedirectUri: boolean;
featureFlags: {
cloneSettings: boolean;
mapEmployees: boolean;
c1Icon: boolean;
c1Options: boolean;
allowForC1: boolean;
exportSettings: {
reimbursableExpenses: boolean;
nameInJournalEntry: boolean;
useMerchantInJournalLine: boolean;
splitExpenseGrouping: boolean;
cccDateConfiguration: boolean;
cccExportGroupConfiguration: boolean;
isEmployeeMappingIsEmployee: boolean;
sentenseCaseConversion: boolean;
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 typo in property name.

The property name sentenseCaseConversion contains a typo and should be sentenceCaseConversion.

-                sentenseCaseConversion: boolean;
+                sentenceCaseConversion: boolean;
📝 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
sentenseCaseConversion: boolean;
sentenceCaseConversion: boolean;

lowerCaseConversion: boolean;
allowAccountsPayableInCoCCC: boolean;
allowBankAccountInCoCCC: boolean;
},
importSettings: {
tax: boolean;
Expand All @@ -25,6 +36,9 @@ export type FeatureConfiguration = {
allowCustomSegment: boolean;
dependentField: boolean;
allowImportCode: boolean;
categoryImportEnabled: boolean;
intacctC1ImportSettings: boolean;
disableCustomerSourceField: boolean;
},
advancedSettings: {
autoCreateVendors: boolean;
Expand All @@ -36,6 +50,7 @@ export type FeatureConfiguration = {
autoCreateContacts: boolean;
useEmployeeAttributes: boolean;
autoCreateMerchants: boolean;
excludeCardNumberAndEmployeeNameInMemo: boolean;
},
exportLog: {
expenseType: boolean;
Expand Down
10 changes: 5 additions & 5 deletions src/app/core/models/common/advanced-settings.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ExportSettingGet } from "../intacct/intacct-configuration/export-settin
import { QBOExportSettingGet } from "../qbo/qbo-configuration/qbo-export-setting.model";
import { NetSuiteExportSettingGet } from "../netsuite/netsuite-configuration/netsuite-export-setting.model";
import { IntacctConfiguration } from "../db/configuration.model";
import { brandingConfig } from 'src/app/branding/branding-config';
import { brandingConfig, brandingContent, brandingFeatureConfig } from 'src/app/branding/branding-config';
export type EmailOption = {
email: string;
name: string;
Expand Down Expand Up @@ -88,12 +88,12 @@ export class AdvancedSettingsModel {
cccExportType = exportSettings.workspace_general_settings?.corporate_credit_card_expenses_object ?? undefined;
}

if (brandingConfig.brandId === 'co') {
if (brandingFeatureConfig.featureFlags.advancedSettings.excludeCardNumberAndEmployeeNameInMemo) {
return defaultOptions.filter(option => option !== 'card_number' && option !== 'employee_name');
}
if (cccExportType && ['netsuite', 'quickbooks online', 'sage intacct'].includes(appName.toLowerCase()) && brandingConfig.brandId === 'fyle') {
return defaultOptions;
}
if (cccExportType && ['netsuite', 'quickbooks online', 'sage intacct'].includes(appName.toLowerCase()) && !brandingFeatureConfig.featureFlags.advancedSettings.excludeCardNumberAndEmployeeNameInMemo) {
return defaultOptions;
}
return defaultOptions.filter(option => option !== 'card_number');

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FormGroup } from "@angular/forms";
import { DefaultDestinationAttribute } from "../../db/destination-attribute.model";
import { FyleField } from "../../enum/enum.model";
import { brandingConfig } from "src/app/branding/branding-config";
import { brandingConfig, brandingFeatureConfig } from "src/app/branding/branding-config";
import { ImportSettingsCustomFieldRow } from "../../common/import-settings.model";

const emptyDestinationAttribute = { id: null, name: null };
Expand Down Expand Up @@ -88,7 +88,7 @@ export class ImportSettings {

let isCategoryImportEnabled = false;

if (brandingConfig.brandId === 'fyle') {
if (brandingFeatureConfig.featureFlags.importSettings.categoryImportEnabled) {
isCategoryImportEnabled = importSettingsForm.get('importCategories')?.value ? importSettingsForm.get('importCategories')?.value : false;
} else {
isCategoryImportEnabled = filteredExpenseFieldArray.filter((field: MappingSetting) => field.source_field === 'CATEGORY' && field.import_to_fyle).length > 0 ? true : false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DefaultDestinationAttribute } from "../../db/destination-attribute.mode
import { AppName, NetsuiteDefaultLevelOptions, NetsuitePaymentSyncDirection, PaymentSyncDirection } from "../../enum/enum.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";
import { environment } from "src/environments/environment";
import { NetSuiteExportSettingGet } from "./netsuite-export-setting.model";

Expand Down Expand Up @@ -75,7 +75,7 @@ export class NetsuiteAdvancedSettingModel extends HelperUtility {
const defaultOptions = this.getDefaultMemoOptions();
const cccExportType = exportSettings.configuration.corporate_credit_card_expenses_object;

if (brandingConfig.brandId === 'co') {
if (brandingFeatureConfig.featureFlags.advancedSettings.excludeCardNumberAndEmployeeNameInMemo) {
return defaultOptions.filter(option => !['card_number', 'employee_name'].includes(option));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export class NetSuiteExportSettingModel extends ExportSettingModel {
}

static getEmployeeFieldMapping(employeeFieldMapping: string): string {
return brandingConfig.brandId === 'co' ? EmployeeFieldMapping.VENDOR : employeeFieldMapping;
return !brandingFeatureConfig.featureFlags.exportSettings.isEmployeeMappingIsEmployee ? EmployeeFieldMapping.VENDOR : employeeFieldMapping;
}

static mapAPIResponseToFormGroup(exportSettings: NetSuiteExportSettingGet | null): FormGroup {
Expand Down Expand Up @@ -295,7 +295,7 @@ export class NetSuiteExportSettingModel extends ExportSettingModel {
const emptyDestinationAttribute: DefaultDestinationAttribute = {id: null, name: null};
const nameInJournalEntry = exportSettingsForm.get('nameInJournalEntry')?.value ? exportSettingsForm.get('nameInJournalEntry')?.value : NameInJournalEntry.EMPLOYEE;

if (brandingConfig.brandId === 'co') {
if (!brandingFeatureConfig.featureFlags.exportSettings.isEmployeeMappingIsEmployee) {
exportSettingsForm.controls.creditCardExpense.patchValue(true);
exportSettingsForm.controls.employeeFieldMapping.patchValue(FyleField.VENDOR);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ImportSettingGeneralMapping } from "../../intacct/intacct-configuration
import { XeroWorkspaceGeneralSetting } from "../db/xero-workspace-general-setting.model";
import { ImportSettingMappingRow, ImportSettingsModel } from "../../common/import-settings.model";
import { IntegrationField } from "../../db/mapping.model";
import { brandingConfig } from "src/app/branding/branding-config";
import { brandingConfig, brandingFeatureConfig } from "src/app/branding/branding-config";
import { ExportSettingModel } from "../../common/export-settings.model";


Expand Down Expand Up @@ -65,7 +65,7 @@ export class XeroImportSettingModel extends ImportSettingsModel {

static mapAPIResponseToFormGroup(importSettings: XeroImportSettingGet | null, xeroFields: IntegrationField[], isCustomerPresent:boolean, destinationAttribute: DestinationAttribute[]): FormGroup {
let additionalOption: any[] = [];
if (brandingConfig.brandId === 'co' && isCustomerPresent) {
if (brandingFeatureConfig.featureFlags.importSettings.disableCustomerSourceField && isCustomerPresent) {
const additionalMappingSetting = {
source_field: 'DISABLED_XERO_SOURCE_FIELD',
destination_field: XeroFyleField.CUSTOMER,
Expand Down
4 changes: 2 additions & 2 deletions src/app/core/services/common/helper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ExportModuleRule, ExportSettingValidatorRule } from '../../models/sage3
import { SnakeCaseToSpaceCasePipe } from 'src/app/shared/pipes/snake-case-to-space-case.pipe';
import { SkipExportValidatorRule, skipExportValidator } from '../../models/common/advanced-settings.model';
import { StorageService } from './storage.service';
import { brandingConfig } from 'src/app/branding/branding-config';
import { brandingConfig, brandingFeatureConfig } from 'src/app/branding/branding-config';
import { SentenceCasePipe } from 'src/app/shared/pipes/sentence-case.pipe';
import { TitleCasePipe } from '@angular/common';
import { DefaultDestinationAttribute, DestinationAttribute } from '../../models/db/destination-attribute.model';
Expand Down Expand Up @@ -260,7 +260,7 @@ export class HelperService {

sentenseCaseConversion(content: string) {
content = new SnakeCaseToSpaceCasePipe().transform(content);
return brandingConfig.brandId === 'co' ? new SentenceCasePipe().transform(content) : content;
return brandingFeatureConfig.featureFlags.exportSettings.sentenseCaseConversion ? new SentenceCasePipe().transform(content) : content;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IntacctConfigurationComponent } from './intacct-configuration.component
import { IntacctExportSettingsComponent } from '../../intacct-shared/intacct-export-settings/intacct-export-settings.component';
import { IntacctImportSettingsComponent } from '../../intacct-shared/intacct-import-settings/intacct-import-settings.component';
import { IntacctAdvancedSettingsComponent } from '../../intacct-shared/intacct-advanced-settings/intacct-advanced-settings.component';
import { brandingConfig } from 'src/app/branding/branding-config';
import { brandingConfig, brandingFeatureConfig } from 'src/app/branding/branding-config';
import { IntacctC1ImportSettingsComponent } from '../../intacct-shared/intacct-c1-import-settings/intacct-c1-import-settings.component';
import { IntacctConnectorComponent } from 'src/app/shared/components/si/core/intacct-connector/intacct-connector.component';

Expand All @@ -23,7 +23,7 @@ const routes: Routes = [
},
{
path: 'import_settings',
component: brandingConfig.brandId === 'fyle' ? IntacctImportSettingsComponent : IntacctC1ImportSettingsComponent
component: !brandingFeatureConfig.featureFlags.importSettings.intacctC1ImportSettings ? IntacctImportSettingsComponent : IntacctC1ImportSettingsComponent
},
{
path: 'advanced_settings',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class IntacctMappingComponent implements OnInit {
if (item.source_field !== FyleField.EMPLOYEE && item.source_field !== FyleField.CATEGORY) {
const mappingPage = new SnakeCaseToSpaceCasePipe().transform(item.source_field);
this.mappingPages.push({
label: brandingConfig.brandId === 'co' ? new SentenceCasePipe().transform(mappingPage) : new TitleCasePipe().transform(mappingPage),
label: brandingFeatureConfig.featureFlags.exportSettings.sentenseCaseConversion ? new SentenceCasePipe().transform(mappingPage) : new TitleCasePipe().transform(mappingPage),
routerLink: `/integrations/intacct/main/mapping/${encodeURIComponent(item.source_field.toLowerCase())}`
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>
<form [formGroup]="exportSettingsForm">
<div class="tw-p-24-px" [ngClass]="{'tw-pt-0': !brandingFeatureConfig.featureFlags.exportSettings.reimbursableExpenses}">
<div *ngIf="brandingConfig.brandId === 'fyle'" class="tw-mb-16-px">
<div *ngIf="!brandingFeatureConfig.featureFlags.allowForC1" class="tw-mb-16-px">
<div *ngIf="brandingFeatureConfig.featureFlags.exportSettings.reimbursableExpenses" class="tw-rounded-lg tw-border-separator tw-border tw-bg-configuration-bg">
<app-configuration-toggle-field
[form]="exportSettingsForm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ export class IntacctExportSettingsComponent implements OnInit {
}

private setupCCCGroupingWatcher(): void {
if (brandingConfig.brandId === 'co') {
if (brandingFeatureConfig.featureFlags.exportSettings.cccExportGroupConfiguration) {
this.updateCCCGroupingDateOptions(this.exportSettingsForm.get('cccExportGroup')?.value);
this.exportSettingsForm.controls.cccExportGroup.valueChanges.subscribe((cccExportGroup) => {
this.updateCCCGroupingDateOptions(cccExportGroup);
Expand Down Expand Up @@ -484,7 +484,7 @@ export class IntacctExportSettingsComponent implements OnInit {
splitExpenseGrouping: new FormControl(this.exportSettings?.expense_group_settings?.split_expense_grouping)
});

if (brandingConfig.brandId === 'co') {
if (!brandingFeatureConfig.featureFlags.exportSettings.isEmployeeMappingIsEmployee) {
this.exportSettingsForm.controls.creditCardExpense.patchValue(true);
this.exportSettingsForm.controls.employeeFieldMapping.patchValue(FyleField.VENDOR);
}
Expand Down Expand Up @@ -525,7 +525,7 @@ export class IntacctExportSettingsComponent implements OnInit {
});

this.exportSettingsForm.controls.cccExportGroup?.valueChanges.subscribe((cccExportGroup) => {
if (brandingConfig.brandId==='fyle') {
if (brandingFeatureConfig.featureFlags.exportSettings.cccDateConfiguration) {
this.cccExpenseGroupingDateOptions = IntacctExportSettingModel.getExpenseGroupingDateOptions();
this.cccExpenseGroupingDateOptions = ExportSettingModel.constructGroupingDateOptions(cccExportGroup, this.cccExpenseGroupingDateOptions);
if (this.exportSettingsForm?.value.cccExportType === IntacctCorporateCreditCardExpensesObject.CHARGE_CARD_TRANSACTION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class NetsuiteMappingComponent implements OnInit {
if (item.source_field !== FyleField.EMPLOYEE && item.source_field !== FyleField.CATEGORY) {
const mappingPage = new SnakeCaseToSpaceCasePipe().transform(item.source_field);
this.mappingPages.push({
label: brandingConfig.brandId === 'co' ? new SentenceCasePipe().transform(mappingPage) : new TitleCasePipe().transform(mappingPage),
label: brandingFeatureConfig.featureFlags.exportSettings.sentenseCaseConversion ? new SentenceCasePipe().transform(mappingPage) : new TitleCasePipe().transform(mappingPage),
routerLink: `/integrations/netsuite/main/mapping/${encodeURIComponent(item.source_field.toLowerCase())}`
});
}
Expand Down
Loading
Loading