Skip to content

Commit

Permalink
PR comments fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyle authored and Fyle committed Mar 15, 2024
1 parent 0635a15 commit a28d569
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 60 deletions.
28 changes: 7 additions & 21 deletions src/app/branding/branding-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,13 @@ const content: ContentConfiguration = {
customFieldPlaceholderName: 'Placeholder name',
customFieldType: 'Field type',
customFieldCreateandSave: 'Create and save',
userId: 'user ID',
companyId: 'company ID',
userPassword: 'User password',
password: 'password',
tenantMapping: 'Tenant Mapping',
descriptionText: 'of the description field'
},
configuration: {
connector: {
configurationHeaderText: 'Connect to Xero Tenant',
configurationSubHeaderText: 'Connect to the Xero Tenant from which you would like to import and export data. The ' + brandingConfig.brandName + ' org and Xero Tenant cannot be changed once the configuration steps are complete.',
stepName: 'Connect to Xero',
subLabel: 'Expenses will be posted to the Xero Tenant Mapping selected here. Once configured, you can not change ' + brandingConfig.brandName + ' organization or Tenant Mapping.'
},
Expand All @@ -291,12 +289,7 @@ const content: ContentConfiguration = {
postEntriesCurrentPeriod: 'Post entries in the current accounting period',
setDescriptionField: 'Set the description field in Xero',
dfvLabel: 'Default field values',
dfvSubLabel: 'If you\'ve made a field mandatory in Xero but don\'t collect a value from your employees in the expense form, you can set a default value here to be added to all the expenses. For location and department, you can opt to use the values from your employee records in Xero.',
location: 'location',
department: 'department',
project: 'project',
class: 'class',
item: 'item'
dfvSubLabel: 'If you\'ve made a field mandatory in Xero but don\'t collect a value from your employees in the expense form, you can set a default value here to be added to all the expenses. For location and department, you can opt to use the values from your employee records in Xero.'
},
done: {
ctaText: '',
Expand Down Expand Up @@ -498,17 +491,15 @@ const content: ContentConfiguration = {
customFieldPlaceholderName: 'Placeholder name',
customFieldType: 'Field type',
customFieldCreateandSave: 'Create and save',
userId: 'user ID',
companyId: 'company ID',
userPassword: 'User password',
password: 'password',
tenantMapping: 'Tenant Mapping',
descriptionText: 'of the description field'
},
configuration: {
connector: {
configurationHeaderText: 'Connect to Xero tenant',
configurationSubHeaderText: 'Connect to the Xero tenant from which you would like to import and export data. The ' + brandingConfig.brandName + ' org and Xero tenant cannot be changed once the configuration steps are complete.',
stepName: 'Connect to Xero',
subLabel: 'Expenses will be posted to the Xero Tenant Mapping selected here. Once configured, you can not change ' + brandingConfig.brandName + ' organization or Tenant Mapping.'
subLabel: 'Expenses will be posted to the Xero tenant Mapping selected here. Once configured, you can not change ' + brandingConfig.brandName + ' organization or tenant mapping.'
},
exportSetting: {
stepName: 'Export settings',
Expand All @@ -531,12 +522,7 @@ const content: ContentConfiguration = {
postEntriesCurrentPeriod: 'Post entries in the current accounting period',
setDescriptionField: 'Set the description field in Xero',
dfvLabel: 'Default field values',
dfvSubLabel: 'If you\'ve made a field mandatory in Xero but don\'t collect a value from your employees in the expense form, you can set a default value here to be added to all the expenses. For location and department, you can opt to use the values from your employee records in Xero.',
location: 'location',
department: 'department',
project: 'project',
class: 'class',
item: 'item'
dfvSubLabel: 'If you\'ve made a field mandatory in Xero but don\'t collect a value from your employees in the expense form, you can set a default value here to be added to all the expenses. For location and department, you can opt to use the values from your employee records in Xero.'
},
done: {
ctaText: '',
Expand Down
11 changes: 2 additions & 9 deletions src/app/core/models/branding/content-configuration.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ export type ContentConfiguration = {
customFieldPlaceholderName: string;
customFieldType: string;
customFieldCreateandSave: string;
userId: string;
companyId: string;
userPassword: string;
password: string;
tenantMapping: string;
descriptionText: string;
},
configuration: {
connector: {
stepName: string;
subLabel: string;
configurationHeaderText: string;
configurationSubHeaderText: string;
},
exportSetting: {
stepName: string;
Expand All @@ -51,11 +49,6 @@ export type ContentConfiguration = {
setDescriptionField: string;
dfvLabel: string;
dfvSubLabel: string;
location: string;
department: string;
project: string;
class: string;
item: string;
},
done: {
ctaText: string;
Expand Down
11 changes: 0 additions & 11 deletions src/app/core/models/xero/db/xero-destination-attribute.model.ts

This file was deleted.

11 changes: 11 additions & 0 deletions src/app/core/models/xero/db/xero-tenant-mapping.model.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { DestinationAttribute } from "../../db/destination-attribute.model";

/* Tslint:disable */
export type TenantMapping = {
id: number;
Expand All @@ -13,3 +15,12 @@ export type TenantMappingPost = {
tenant_id: string;
tenant_name: string;
}

export class TenantMappingModel {
static constructPayload(tenantMapping: DestinationAttribute): TenantMappingPost {
return {
tenant_id: tenantMapping.id.toString(),
tenant_name: tenantMapping.value
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CacheBuster, Cacheable, globalCacheBusterNotifier } from 'ts-cacheable'
import { XeroCredentials } from 'src/app/core/models/xero/db/xero-credential.model';
import { environment } from 'src/environments/environment';
import { TenantMapping, TenantMappingPost } from 'src/app/core/models/xero/db/xero-tenant-mapping.model';
import { XeroDestinationAttributes } from 'src/app/core/models/xero/db/xero-destination-attribute.model';
import { DestinationAttribute } from 'src/app/core/models/db/destination-attribute.model';

const xeroCredentialsCache = new Subject<void>();

Expand Down Expand Up @@ -49,11 +49,11 @@ export class XeroConnectorService {
return this.apiService.get(`/workspaces/${workspaceId}/xero/token_health/`, {});
}

getXeroTenants(): Observable<XeroDestinationAttributes[]> {
getXeroTenants(): Observable<DestinationAttribute[]> {
return this.apiService.get(`/workspaces/${this.workspaceId}/xero/tenants/`, {attribute_type: 'TENANT'});
}

postXeroTenants(): Observable<XeroDestinationAttributes[]> {
postXeroTenants(): Observable<DestinationAttribute[]> {
const workspaceId = this.workspaceService.getWorkspaceId();

return this.apiService.post(`/workspaces/${workspaceId}/xero/tenants/`, {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<div *ngIf="!isLoading" class="configuration--contents tw-border-border-tertiary tw-mt-24-px" [ngClass]="{'tw-mx-120-px tw-shadow-app-card': brandingConfig.brandId === 'fyle', 'tw-mx-60-px tw-shadow-shadow-level-1': brandingConfig.brandId === 'co'}">
<div>
<app-configuration-step-header
[headerText]="'Connect to Xero Tenant'"
[contentText]="'Connect to the Xero Tenant from which you would like to import and export data. The ' + brandingConfig.brandName + ' org and Xero Tenant cannot be changed once the configuration steps are complete.'"
[headerText]="brandingContent.configurationHeaderText"
[contentText]="brandingContent.configurationSubHeaderText"
[redirectLink]="redirectLink">
</app-configuration-step-header>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { Subscription } from 'rxjs';
import { brandingConfig, brandingContent, 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 { DestinationAttribute } from 'src/app/core/models/db/destination-attribute.model';
import { ConfigurationCta, ConfigurationWarningEvent, ToastSeverity, XeroOnboardingState } from 'src/app/core/models/enum/enum.model';
import { ConfigurationWarningOut } from 'src/app/core/models/misc/configuration-warning.model';
import { OnboardingStepper } from 'src/app/core/models/misc/onboarding-stepper.model';
import { XeroCredentials } from 'src/app/core/models/xero/db/xero-credential.model';
import { XeroDestinationAttributes } from 'src/app/core/models/xero/db/xero-destination-attribute.model';
import { TenantMapping, TenantMappingPost } from 'src/app/core/models/xero/db/xero-tenant-mapping.model';
import { TenantMapping, TenantMappingModel, TenantMappingPost } from 'src/app/core/models/xero/db/xero-tenant-mapping.model';
import { XeroExportSettingGet } from 'src/app/core/models/xero/xero-configuration/xero-export-settings.model';
import { XeroOnboardingModel } from 'src/app/core/models/xero/xero-configuration/xero-onboarding.model';
import { CloneSettingService } from 'src/app/core/services/common/clone-setting.service';
Expand Down Expand Up @@ -73,9 +73,9 @@ export class XeroOnboardingConnectorComponent implements OnInit {

showDisconnectXero: boolean;

tenantList: XeroDestinationAttributes[];
tenantList: DestinationAttribute[];

xeroTenantselected: XeroDestinationAttributes;
xeroTenantselected: DestinationAttribute;

constructor(
private workspaceService: WorkspaceService,
Expand Down Expand Up @@ -148,7 +148,7 @@ export class XeroOnboardingConnectorComponent implements OnInit {
});
}

connectXero(companyDetails: XeroDestinationAttributes): void {
connectXero(companyDetails: DestinationAttribute): void {
this.xeroTenantselected = companyDetails;
this.isContinueDisabled = false;
}
Expand Down Expand Up @@ -182,10 +182,7 @@ export class XeroOnboardingConnectorComponent implements OnInit {
if (this.xeroTenantselected && !this.isContinueDisabled) {
this.xeroConnectionInProgress = true;
this.isContinueDisabled = true;
const tenantMappingPayload: TenantMappingPost = {
tenant_id: this.xeroTenantselected.id.toString(),
tenant_name: this.xeroTenantselected.value
};
const tenantMappingPayload: TenantMappingPost = TenantMappingModel.constructPayload(this.xeroTenantselected);
this.xeroConnectorService.postTenantMapping(tenantMappingPayload).subscribe((response:TenantMapping) => {
this.xeroHelperService.refreshXeroDimensions().subscribe(() => {
this.workspaceService.setOnboardingState(XeroOnboardingState.EXPORT_SETTINGS);
Expand Down Expand Up @@ -218,8 +215,12 @@ export class XeroOnboardingConnectorComponent implements OnInit {
}

getTenant() {
this.xeroConnectorService.getXeroTenants().subscribe((tenantList: XeroDestinationAttributes[]) => {
this.xeroConnectorService.getXeroTenants().subscribe((tenantList: DestinationAttribute[]) => {
this.tenantList = tenantList;
this.isXeroConnected = false;
this.isContinueDisabled = true;
this.xeroConnectionInProgress = false;
this.showOrHideDisconnectXero();
});
}

Expand Down Expand Up @@ -248,10 +249,6 @@ export class XeroOnboardingConnectorComponent implements OnInit {
},
() => {
this.getTenant();
this.isXeroConnected = false;
this.isContinueDisabled = true;
this.showOrHideDisconnectXero();
this.xeroConnectionInProgress = false;
});
}

Expand Down

0 comments on commit a28d569

Please sign in to comment.