Skip to content

Commit

Permalink
Submodule initialization & functions (init; getBidRequestData) skelet…
Browse files Browse the repository at this point in the history
…ons (#2)
  • Loading branch information
bwhisp committed Jul 13, 2022
1 parent 3cac5cc commit a8bfc74
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions modules/1plusXRtdProvider.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
// Constants
const MODULE_NAME = ''
import { submodule } from "../src/hook"
// Constants
const REAL_TIME_MODULE = 'realTimeData'
const MODULE_NAME = '1plusX'

// Functions
const getBidRequestDataAsync = async (reqBidsConfigObj, config, userConsent) => {
// Maybe treat the case where we already have the audiences & segments in local storage
// Get the required config
// Call PAPI
// -- Then :
// ---- extract relevant data
// ---- set the data to the bid
// -- Catch : print err & do nothing
}

// Functions exported in submodule object
const init = () => { }
const getBidRequestData = () => { }
const init = (config, userConsent) => {
// We prolly get the config again in getBidRequestData
return true;
}

const getBidRequestData = (reqBidsConfigObj, callback, config, userConsent) => {
getBidRequestDataAsync(reqBidsConfigObj, config, userConsent)
.then(() => callback())
.catch((err) => {
console.error(err);
callback();
})
}

// The RTD submodule object to be exported
export const onePlusXSubmodule = {
name: MODULE_NAME,
init,
getBidRequestData
}
}

// Register the onePlusXSubmodule as submodule of realTimeData
submodule(REAL_TIME_MODULE, MODULE_NAME);

0 comments on commit a8bfc74

Please sign in to comment.