File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ const titleID = 'DuckDuckGoPrivacyEssentialsCTLElementTitle'
22
22
// @see {getConfig}
23
23
let config = null
24
24
let sharedStrings = null
25
- let styles = null
25
+ let styles = getStyles ( )
26
26
27
27
// TODO: Remove these redundant data structures and refactor the related code.
28
28
// There should be no need to have the entity configuration stored in two
@@ -1613,10 +1613,13 @@ export default class ClickToLoad extends ContentFeature {
1613
1613
const websiteOwner = args ?. site ?. parentEntity
1614
1614
const settings = args ?. featureSettings ?. clickToLoad || { }
1615
1615
const locale = args ?. locale || 'en'
1616
- const localizedConfig = getConfig ( locale , args ?. assets )
1616
+ const localizedConfig = getConfig ( locale )
1617
1617
config = localizedConfig . config
1618
1618
sharedStrings = localizedConfig . sharedStrings
1619
- styles = localizedConfig . styles
1619
+ // update styles if asset config was sent
1620
+ if ( args ?. assets ) {
1621
+ styles = getStyles ( args . assets )
1622
+ }
1620
1623
1621
1624
for ( const entity of Object . keys ( config ) ) {
1622
1625
// Strip config entities that are first-party, or aren't enabled in the
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import localesJSON from '../../../build/locales/ctl-locales.js'
16
16
/**
17
17
* Get CSS style defintions for CTL, using the provided AssetConfig for any non-embedded assets
18
18
* (e.g. fonts.)
19
- * @param {AssetConfig } assets
19
+ * @param {AssetConfig } [ assets]
20
20
*/
21
21
export function getStyles ( assets ) {
22
22
let fontStyle = ''
@@ -616,15 +616,13 @@ export function getStyles (assets) {
616
616
617
617
/**
618
618
* @param {string } locale UI locale
619
- * @param {AssetConfig } assets Config for UI assets
620
619
*/
621
- export function getConfig ( locale , assets ) {
620
+ export function getConfig ( locale ) {
622
621
const locales = JSON . parse ( localesJSON )
623
622
const fbStrings = locales [ locale ] [ 'facebook.json' ]
624
623
const ytStrings = locales [ locale ] [ 'youtube.json' ]
625
624
626
625
const sharedStrings = locales [ locale ] [ 'shared.json' ]
627
- const styles = getStyles ( assets )
628
626
const config = {
629
627
'Facebook, Inc.' : {
630
628
informationalModal : {
@@ -1033,5 +1031,5 @@ export function getConfig (locale, assets) {
1033
1031
}
1034
1032
}
1035
1033
1036
- return { config, sharedStrings, styles }
1034
+ return { config, sharedStrings }
1037
1035
}
You can’t perform that action at this time.
0 commit comments