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
@@ -1618,10 +1618,13 @@ export default class ClickToLoad extends ContentFeature {
1618
1618
const websiteOwner = args ?. site ?. parentEntity
1619
1619
const settings = args ?. featureSettings ?. clickToLoad || { }
1620
1620
const locale = args ?. locale || 'en'
1621
- const localizedConfig = getConfig ( locale , args ?. assets )
1621
+ const localizedConfig = getConfig ( locale )
1622
1622
config = localizedConfig . config
1623
1623
sharedStrings = localizedConfig . sharedStrings
1624
- styles = localizedConfig . styles
1624
+ // update styles if asset config was sent
1625
+ if ( args ?. assets ) {
1626
+ styles = getStyles ( args . assets )
1627
+ }
1625
1628
1626
1629
for ( const entity of Object . keys ( config ) ) {
1627
1630
// 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 = ''
@@ -624,15 +624,13 @@ export function getStyles (assets) {
624
624
625
625
/**
626
626
* @param {string } locale UI locale
627
- * @param {AssetConfig } assets Config for UI assets
628
627
*/
629
- export function getConfig ( locale , assets ) {
628
+ export function getConfig ( locale ) {
630
629
const locales = JSON . parse ( localesJSON )
631
630
const fbStrings = locales [ locale ] [ 'facebook.json' ]
632
631
const ytStrings = locales [ locale ] [ 'youtube.json' ]
633
632
634
633
const sharedStrings = locales [ locale ] [ 'shared.json' ]
635
- const styles = getStyles ( assets )
636
634
const config = {
637
635
'Facebook, Inc.' : {
638
636
informationalModal : {
@@ -1041,5 +1039,5 @@ export function getConfig (locale, assets) {
1041
1039
}
1042
1040
}
1043
1041
1044
- return { config, sharedStrings, styles }
1042
+ return { config, sharedStrings }
1045
1043
}
You can’t perform that action at this time.
0 commit comments