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

Submodule initialization & functions (init; getBidRequestData) skeletons #2

Merged
merged 5 commits into from
Jun 8, 2022
Merged
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
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);