Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Halo RTD Module: FPD 2.0 Updates & add ID system tests #6505

Merged
merged 16 commits into from
Apr 19, 2021
3 changes: 2 additions & 1 deletion modules/haloIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {submodule} from '../src/hook.js';
import * as utils from '../src/utils.js';

const MODULE_NAME = 'haloId';
const AU_GVLID = 561;

export const storage = getStorageManager();
export const storage = getStorageManager(AU_GVLID, 'halo');

/** @type {Submodule} */
export const haloIdSubmodule = {
Expand Down
14 changes: 6 additions & 8 deletions modules/haloRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import {getStorageManager} from '../src/storageManager.js';
import {submodule} from '../src/hook.js';
import {isFn, isStr, isPlainObject, mergeDeep, logError} from '../src/utils.js';

export const storage = getStorageManager();

const MODULE_NAME = 'realTimeData';
const SUBMODULE_NAME = 'halo';
const AU_GVLID = 561;

export const storage = getStorageManager(AU_GVLID, SUBMODULE_NAME);

export const HALOID_LOCAL_NAME = 'auHaloId';
export const RTD_LOCAL_NAME = 'auHaloRtd';
Expand Down Expand Up @@ -69,15 +70,12 @@ function paramOrDefault(param, defaultVal) {
* @param {Object} rtdConfig
*/
export function addRealTimeData(bidConfig, rtd, rtdConfig) {
if (!isPlainObject(config.getConfig().ortb2)) {
config.setConfig({ortb2: {}});
}
let ortb2 = config.getConfig().ortb2 || {};
antlauzon marked this conversation as resolved.
Show resolved Hide resolved

if (rtdConfig.params && rtdConfig.params.handleRtd) {
rtdConfig.params.handleRtd(bidConfig, rtd, rtdConfig, config);
} else if (rtd.ortb2) {
let mergedOrtb = mergeLazy(config.getConfig().ortb2, rtd.ortb2);
config.setConfig({ortb2: mergedOrtb});
config.setConfig({ortb2: mergeLazy(ortb2, rtd.ortb2)});
}
}

Expand All @@ -89,7 +87,7 @@ export function addRealTimeData(bidConfig, rtd, rtdConfig) {
* @param {Object} userConsent
*/
export function getRealTimeData(bidConfig, onDone, rtdConfig, userConsent) {
if (isPlainObject(rtdConfig.params) && rtdConfig.params.segmentCache) {
if (rtdConfig && isPlainObject(rtdConfig.params) && rtdConfig.params.segmentCache) {
let jsonData = storage.getDataFromLocalStorage(RTD_LOCAL_NAME);

if (jsonData) {
Expand Down