1616 * under the License.
1717 */
1818
19+ import { AuthClientConfig } from '@asgardeo/auth-js' ;
1920import merge from 'lodash.merge' ;
2021import { TextObject } from './screens/model' ;
2122import getBrandingPreferenceText from '../api/get-branding-preference-text' ;
2223import { AuthClient } from '../auth-client' ;
2324import AsgardeoUIException from '../exception' ;
25+ import { UIAuthConfig } from '../models/auth-config' ;
26+ import { BrandingPreferenceTypes } from '../models/branding-api-response' ;
2427import { BrandingPreferenceTextAPIResponse } from '../models/branding-text-api-response' ;
2528import GetLocalizationProps from '../models/get-localization-props' ;
2629
@@ -31,20 +34,22 @@ import GetLocalizationProps from '../models/get-localization-props';
3134 * @returns {Promise<Customization> } A promise that resolves with the merged branding properties.
3235 */
3336const getLocalization = async ( props : GetLocalizationProps ) : Promise < TextObject > => {
34- const { componentCustomization , locale, providerCustomization , screen} = props ;
37+ const { componentTextOverrides , locale, providerTextOverrides , screen} = props ;
3538
3639 const module : TextObject = await import ( `./screens/${ screen } /${ locale } .ts` ) ;
3740
3841 let textFromConsoleBranding : BrandingPreferenceTextAPIResponse ;
3942
43+ const configData : AuthClientConfig < UIAuthConfig > = await AuthClient . getInstance ( ) . getDataLayer ( ) . getConfigData ( ) ;
44+
4045 try {
41- if ( ( await AuthClient . getInstance ( ) . getDataLayer ( ) . getConfigData ( ) ) . enableConsoleTextBranding ?? true ) {
42- textFromConsoleBranding = await getBrandingPreferenceText (
46+ if ( configData . enableConsoleTextBranding ?? true ) {
47+ textFromConsoleBranding = await getBrandingPreferenceText ( {
4348 locale,
44- providerCustomization . name ,
49+ name : configData . name ?? 'carbon.super' ,
4550 screen,
46- providerCustomization . type ,
47- ) ;
51+ type : configData . type ?? BrandingPreferenceTypes . Org ,
52+ } ) ;
4853 }
4954 } catch ( error ) {
5055 throw new AsgardeoUIException (
@@ -69,11 +74,11 @@ const getLocalization = async (props: GetLocalizationProps): Promise<TextObject>
6974 /**
7075 * PRIORITY 02: Text from provider customization
7176 */
72- providerCustomization ?. preference ?. text ?. [ locale ] ?. [ screen ] ?? { } ,
77+ providerTextOverrides ?. [ locale ] ?. [ screen ] ?? { } ,
7378 /**
7479 * PRIORITY 01: Text from component customization
7580 */
76- componentCustomization ?. preference ?. text ?. [ locale ] ?. [ screen ] ?? { } ,
81+ componentTextOverrides ?. [ locale ] ?. [ screen ] ?? { } ,
7782 ) ;
7883
7984 return mergedText ;
0 commit comments