Apply styles from settings

This commit is contained in:
Emili Castells Guasch 2024-05-01 14:54:59 +02:00
parent 27835fc51a
commit 5615994128
3 changed files with 62 additions and 16 deletions

View file

@ -642,7 +642,8 @@ class AxoManager {
return {
fields: {
cardholderName: {} // optionally pass this to show the card holder name
}
},
styles: this.remove_keys_with_empty_string(this.axoConfig.style_options)
}
}
@ -743,6 +744,20 @@ class AxoManager {
return this.axoConfig?.widgets?.email === 'use_widget';
}
remove_keys_with_empty_string = (obj) => {
for(let key of Object.keys(obj)){
if (obj[key] === ''){
delete obj[key];
}
else if (typeof obj[key] === 'object'){
obj[key] = this.remove_keys_with_empty_string(obj[key]);
if (Object.keys(obj[key]).length === 0 ) delete obj[key];
}
}
return Array.isArray(obj) ? obj.filter(val => val) : obj;
}
}
export default AxoManager;