Skip to content

Commit

Permalink
Deleted setting default value {} for config in init. Ensured that no …
Browse files Browse the repository at this point in the history
…field in config was changed inside the funtions. Added test script example in the documentation. (#10413)
  • Loading branch information
AYlitepsa committed Sep 5, 2023
1 parent aeaf23e commit ceccd88
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
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

0 comments on commit ceccd88

Please sign in to comment.