feat: Enhance ChatAssistant and ProductFilters components with dynamic privacy prompts and category push notification support; update localization strings for new article notifications across multiple languages
This commit is contained in:
@@ -448,6 +448,29 @@ class Content extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
// JTL kKategorie for category push: backend may omit dataParam — resolve from tree (same id as product list)
|
||||
const isValidJtlCategoryId = (v) => {
|
||||
if (v == null || v === '') return false;
|
||||
const n = typeof v === 'number' ? v : parseInt(String(v), 10);
|
||||
return Number.isFinite(n) && n > 0;
|
||||
};
|
||||
if (categoryId !== 'neu' && categoryId !== 'bald' && !isValidJtlCategoryId(enhancedResponse.dataParam)) {
|
||||
try {
|
||||
const currentLanguage = this.props.languageContext?.currentLanguage || this.props.i18n?.language || 'de';
|
||||
const categoryTreeCache = window.categoryService.getSync(209, currentLanguage);
|
||||
if (categoryTreeCache) {
|
||||
const targetCategory = typeof categoryId === 'string'
|
||||
? this.findCategoryBySeoName(categoryTreeCache, categoryId)
|
||||
: this.findCategoryById(categoryTreeCache, categoryId);
|
||||
if (targetCategory && typeof targetCategory.id === 'number' && targetCategory.id > 0) {
|
||||
enhancedResponse.dataParam = targetCategory.id;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error resolving dataParam from category tree:', err);
|
||||
}
|
||||
}
|
||||
|
||||
this.processData(enhancedResponse);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user