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

NeuwoRtdModule: Removed the default value to config in init and ensured that config vals are not changed #10413

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions modules/neuwoRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ const SEGTAX_IAB = 6 // IAB - Content Taxonomy version 2
const RESPONSE_IAB_TIER_1 = 'marketing_categories.iab_tier_1'
const RESPONSE_IAB_TIER_2 = 'marketing_categories.iab_tier_2'

function init(config = {}, userConsent) {
config.params = config.params || {}
function init(config, userConsent) {
// config.params = config.params || {}
// ignore module if publicToken is missing (module setup failure)
if (!config.params.publicToken) {
if (!config || !config.params || !config.params.publicToken) {
logError('publicToken missing', 'NeuwoRTDModule', 'config.params.publicToken')
return false;
}
if (!config.params.apiUrl) {
if (!config || !config.params || !config.params.apiUrl) {
logError('apiUrl missing', 'NeuwoRTDModule', 'config.params.apiUrl')
return false;
}
return true;
}

export function getBidRequestData(reqBidsConfigObj, callback, config, userConsent) {
config.params = config.params || {};
const confParams = config.params || {};
logInfo('NeuwoRTDModule', 'starting getBidRequestData')

const wrappedArgUrl = encodeURIComponent(config.params.argUrl || getRefererInfo().page);
const wrappedArgUrl = encodeURIComponent(confParams.argUrl || getRefererInfo().page);
/* adjust for pages api.url?prefix=test (to add params with '&') as well as api.url (to add params with '?') */
const joiner = config.params.apiUrl.indexOf('?') < 0 ? '?' : '&'
const url = config.params.apiUrl + joiner + [
'token=' + config.params.publicToken,
const joiner = confParams.apiUrl.indexOf('?') < 0 ? '?' : '&'
const url = confParams.apiUrl + joiner + [
'token=' + confParams.publicToken,
'url=' + wrappedArgUrl
].join('&')
const billingId = generateUUID();
Expand Down
2 changes: 2 additions & 0 deletions modules/neuwoRtdProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ pbjs.setConfig({realTimeData: { dataProviders: [ neuwoDataProvider ]}})

# Testing

`gulp test --modules=rtdModule,neuwoRtdProvider`

## Add development tools if necessary

- Install node for npm
Expand Down