Skip to content

Commit e70ba4e

Browse files
author
Jaimin Panchal
committed
bugfix
1 parent 2b81856 commit e70ba4e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

modules/categoryTranslation.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ export function getAdserverCategoryHook(fn, adUnitCode, bid) {
3535
registerAdserver();
3636
}
3737

38+
let localStorageKey = (config.getConfig('brandCategoryTranslation.translationFile')) ? DEFAULT_IAB_TO_FW_MAPPING_KEY_PUB : DEFAULT_IAB_TO_FW_MAPPING_KEY;
39+
3840
if (bid.meta && !bid.meta.adServerCatId) {
39-
let mapping = getDataFromLocalStorage(DEFAULT_IAB_TO_FW_MAPPING_KEY);
41+
let mapping = getDataFromLocalStorage(localStorageKey);
4042
if (mapping) {
4143
try {
4244
mapping = JSON.parse(mapping);
45+
mapping = mapping['data'];
4346
} catch (error) {
4447
logError('Failed to parse translation mapping file');
4548
}
@@ -72,7 +75,7 @@ export function initTranslation(...args) {
7275
response = JSON.parse(response);
7376
let mapping = {
7477
lastUpdated: timestamp(),
75-
mapping: response.mapping
78+
data: response
7679
}
7780
setDataInLocalStorage(localStorageKey, JSON.stringify(mapping));
7881
} catch (error) {

test/spec/modules/categoryTranslation_spec.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ describe('category translation', function () {
2525
}
2626

2727
getLocalStorageStub.returns(JSON.stringify({
28-
'freewheel': {
29-
mapping: {
30-
'iab-1': '1'
28+
'data': {
29+
'freewheel': {
30+
mapping: {
31+
'iab-1': '1'
32+
}
3133
}
3234
}
3335
}));

0 commit comments

Comments
 (0)