|
12 | 12 | */
|
13 | 13 |
|
14 | 14 | import { config } from '../src/config';
|
15 |
| -import { hooks, hook } from '../src/hook'; |
| 15 | +import { setupBeforeHookFnOnce, hook } from '../src/hook'; |
16 | 16 | import { ajax } from '../src/ajax';
|
17 | 17 | import { timestamp, logError, setDataInLocalStorage, getDataFromLocalStorage } from '../src/utils';
|
| 18 | +import { addBidResponse } from '../src/auction'; |
18 | 19 |
|
19 | 20 | const DEFAULT_TRANSLATION_FILE_URL = '//cdn.jsdelivr.net/gh/prebid/category-mapping-file@1/freewheel-mapping.json';
|
20 | 21 | const DEFAULT_IAB_TO_FW_MAPPING_KEY = 'iabToFwMappingkey';
|
@@ -63,15 +64,7 @@ export function getAdserverCategoryHook(fn, adUnitCode, bid) {
|
63 | 64 | }
|
64 | 65 |
|
65 | 66 | export function initTranslation(url, localStorageKey) {
|
66 |
| - // TODO use function from adpod module |
67 |
| - function setupHookFnOnce(hookId, hookFn, priority = 15) { |
68 |
| - let result = hooks[hookId].getHooks({hook: hookFn}); |
69 |
| - if (result.length === 0) { |
70 |
| - hooks[hookId].before(hookFn, priority); |
71 |
| - } |
72 |
| - } |
73 |
| - |
74 |
| - setupHookFnOnce('addBidResponse', getAdserverCategoryHook, 50); |
| 67 | + setupBeforeHookFnOnce(addBidResponse, getAdserverCategoryHook, 50); |
75 | 68 | let mappingData = getDataFromLocalStorage(localStorageKey);
|
76 | 69 | if (!mappingData || timestamp() < mappingData.lastUpdated + refreshInDays * 24 * 60 * 60 * 1000) {
|
77 | 70 | ajax(url,
|
|
0 commit comments