@@ -16,6 +16,7 @@ import { StorageService } from 'src/app/core/services/common/storage.service';
16
16
import { NetsuiteAuthService } from 'src/app/core/services/netsuite/netsuite-core/netsuite-auth.service' ;
17
17
import { XeroAuthService } from 'src/app/core/services/xero/xero-core/xero-auth.service' ;
18
18
import { exposeAppConfig } from 'src/app/branding/expose-app-config' ;
19
+ import { brandingConfig } from 'src/app/branding/branding-config' ;
19
20
20
21
@Component ( {
21
22
selector : 'app-login' ,
@@ -24,7 +25,11 @@ import { exposeAppConfig } from 'src/app/branding/expose-app-config';
24
25
} )
25
26
export class LoginComponent implements OnInit {
26
27
27
- readonly exposeApps = exposeAppConfig ;
28
+ readonly brandingConfig = brandingConfig ;
29
+
30
+ readonly isINCluster = this . storageService . get ( 'cluster-domain' ) . includes ( 'in1' ) ;
31
+
32
+ readonly exposeApps = ! this . isINCluster ? exposeAppConfig [ brandingConfig . brandId ] [ brandingConfig . envId ] : exposeAppConfig [ brandingConfig . brandId ] [ 'production-1-in' ] ;
28
33
29
34
constructor (
30
35
private authService : AuthService ,
@@ -67,37 +72,37 @@ export class LoginComponent implements OnInit {
67
72
} ;
68
73
this . userService . storeUserProfile ( user ) ;
69
74
70
- if ( this . exposeApps . fyle . QBD && this . exposeApps . co . QBD ) {
75
+ if ( this . exposeApps . QBD ) {
71
76
this . helperService . setBaseApiURL ( AppUrl . QBD ) ;
72
77
this . qbdAuthService . qbdLogin ( clusterDomainWithToken . tokens . refresh_token ) . subscribe ( ) ;
73
78
}
74
79
75
- if ( this . exposeApps . fyle . SAGE300 && this . exposeApps . co . SAGE300 ) {
80
+ if ( this . exposeApps . SAGE300 ) {
76
81
this . helperService . setBaseApiURL ( AppUrl . SAGE300 ) ;
77
82
this . sage300AuthService . loginWithRefreshToken ( clusterDomainWithToken . tokens . refresh_token ) . subscribe ( ) ;
78
83
}
79
84
80
- if ( this . exposeApps . fyle . BUSINESS_CENTRAL && this . exposeApps . co . BUSINESS_CENTRAL ) {
85
+ if ( this . exposeApps . BUSINESS_CENTRAL ) {
81
86
this . helperService . setBaseApiURL ( AppUrl . BUSINESS_CENTRAL ) ;
82
87
this . businessCentralAuthService . loginWithRefreshToken ( clusterDomainWithToken . tokens . refresh_token ) . subscribe ( ) ;
83
88
}
84
89
85
90
// Only local dev needs this, login happens via postMessage for prod/staging through webapp
86
91
if ( ! environment . production ) {
87
92
this . userService . storeUserProfile ( user ) ;
88
- if ( this . exposeApps . fyle . QBO && this . exposeApps . co . QBO ) {
93
+ if ( this . exposeApps . QBO ) {
89
94
this . helperService . setBaseApiURL ( AppUrl . QBO ) ;
90
95
this . qboAuthService . loginWithRefreshToken ( clusterDomainWithToken . tokens . refresh_token ) . subscribe ( ) ;
91
96
}
92
- if ( this . exposeApps . fyle . INTACCT && this . exposeApps . co . INTACCT ) {
97
+ if ( this . exposeApps . INTACCT ) {
93
98
this . helperService . setBaseApiURL ( AppUrl . INTACCT ) ;
94
99
this . siAuthService . loginWithRefreshToken ( clusterDomainWithToken . tokens . refresh_token ) . subscribe ( ) ;
95
100
}
96
- if ( this . exposeApps . fyle . NETSUITE && this . exposeApps . co . NETSUITE ) {
101
+ if ( this . exposeApps . NETSUITE ) {
97
102
this . helperService . setBaseApiURL ( AppUrl . NETSUITE ) ;
98
103
this . netsuiteAuthService . loginWithRefreshToken ( clusterDomainWithToken . tokens . refresh_token ) . subscribe ( ) ;
99
104
}
100
- if ( this . exposeApps . fyle . XERO && this . exposeApps . co . XERO ) {
105
+ if ( this . exposeApps . XERO ) {
101
106
this . helperService . setBaseApiURL ( AppUrl . XERO ) ;
102
107
this . xeroAuthService . loginWithRefreshToken ( clusterDomainWithToken . tokens . refresh_token ) . subscribe ( ) ;
103
108
}
0 commit comments