diff --git a/gulpfile.js b/gulpfile.js index 046d536b740..362a38671b3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -38,7 +38,7 @@ console.timeEnd('Loading Plugins in Prebid'); const FAKE_SERVER_HOST = argv.host ? argv.host : 'localhost'; const FAKE_SERVER_PORT = 4444; const { spawn } = require('child_process'); - +prebid.profile = argv.profile; // these modules must be explicitly listed in --modules to be included in the build, won't be part of "all" modules var explicitModules = [ 'pre1api' @@ -164,7 +164,6 @@ function makeDevpackPkg() { const analyticsSources = helpers.getAnalyticsSources(); const moduleSources = helpers.getModulePaths(externalModules); - return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js')) .pipe(helpers.nameModules(externalModules)) .pipe(webpackStream(cloned, webpack)) @@ -257,7 +256,7 @@ function bundle(dev, moduleArr) { // gutil.log('Concatenating files:\n', entries); // gutil.log('Appending ' + prebid.globalVarName + '.processQueue();'); // gutil.log('Generating bundle:', outputFileName); - + var globalVarName = /*argv.profile === "IH" ? prebid.ihGlobalVarName : */ prebid.globalVarName; return gulp.src( entries ) @@ -266,7 +265,7 @@ function bundle(dev, moduleArr) { .pipe(gulpif(dev, sourcemaps.init({ loadMaps: true }))) .pipe(concat(outputFileName)) .pipe(gulpif(!argv.manualEnable, footer('\n<%= global %>.processQueue();', { - global: prebid.globalVarName + global: globalVarName } ))) .pipe(gulpif(dev, sourcemaps.write('.'))); @@ -457,4 +456,4 @@ gulp.task('bundle', gulpBundle.bind(null, false)); // used for just concatenatin gulp.task(viewReview); gulp.task('review-start', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, testCoverage), viewReview)); -module.exports = nodeBundle; \ No newline at end of file +module.exports = nodeBundle; diff --git a/modules/userId/index.js b/modules/userId/index.js index 4b54eb60230..8e75331a334 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -799,9 +799,14 @@ function setUserIdentities(userIdentityData) { delete userIdentityData.pubProvidedEmail; } Object.assign(userIdentity, userIdentityData); - if (window.PWT && window.PWT.loginEvent) { + if ((window.IHPWT && window.IHPWT.loginEvent) || (window.PWT && window.PWT.loginEvent)) { reTriggerPartnerCallsWithEmailHashes(); - window.PWT.loginEvent = false; + if (window.IHPWT) { + window.IHPWT.loginEvent = false; + } + if (window.PWT) { + window.PWT.loginEvent = false; + } } }; @@ -821,7 +826,7 @@ export function updateModuleParams(moduleToUpdate) { if (!params) return; let userIdentity = getUserIdentities() || {}; - let enableSSO = (window.PWT && window.PWT.ssoEnabled) || false; + let enableSSO = (window.IHPWT && window.IHPWT.ssoEnabled) || (window.PWT && window.PWT.ssoEnabled) || false; let emailHashes = enableSSO && userIdentity.emailHash ? userIdentity.emailHash : userIdentity.pubProvidedEmailHash ? userIdentity.pubProvidedEmailHash : undefined; params.forEach(function(param) { moduleToUpdate.params[param.key] = (moduleToUpdate.name === 'id5Id' ? getRawPDString(emailHashes, userIdentity.userID) : emailHashes ? emailHashes[param.hashType] : undefined); @@ -887,9 +892,8 @@ function getUserIdentities() { function processFBLoginData(refThis, response) { let emailHash = {}; if (response.status === 'connected') { - window.PWT = window.PWT || {}; - window.PWT.fbAt = response.authResponse.accessToken; - window.FB && window.FB.api('/me?fields=email&access_token=' + window.PWT.fbAt, function (response) { + // window.IHPWT = window.IHPWT || {}; + window.FB && window.FB.api('/me?fields=email&access_token=' + response.authResponse.accessToken, function (response) { logInfo('SSO - Data received from FB API'); if (response.error) { logInfo('SSO - User information could not be retrieved by facebook api [', response.error.message, ']'); @@ -915,7 +919,7 @@ function onSSOLogin(data) { let refThis = this; let email; let emailHash = {}; - if (!window.PWT || !window.PWT.ssoEnabled) return; + if ((window.IHPWT && !window.IHPWT.ssoEnabled) || (window.PWT && !window.PWT.ssoEnabled)) return; switch (data.provider) { case undefined: diff --git a/package.json b/package.json index 494f66bc418..23a35d5b6e2 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "prebid" ], "globalVarName": "owpbjs", + "ihGlobalVarName": "ihowpbjs", "author": "the prebid.js contributors", "license": "Apache-2.0", "engines": { diff --git a/plugins/pbjsGlobals.js b/plugins/pbjsGlobals.js index 79dafd1e8b2..d19666da237 100644 --- a/plugins/pbjsGlobals.js +++ b/plugins/pbjsGlobals.js @@ -4,7 +4,7 @@ let prebid = require('../package.json'); const path = require('path'); module.exports = function(api, options) { - const pbGlobal = options.globalVarName || prebid.globalVarName; + const pbGlobal = prebid.profile === "IH" ? prebid.ihGlobalVarName : prebid.globalVarName; //options.globalVarName || prebid.globalVarName; let replace = { '$prebid.version$': prebid.version, '$$PREBID_GLOBAL$$': pbGlobal, diff --git a/webpack.conf.js b/webpack.conf.js index 5269f5300f5..9c7a8afdcb0 100644 --- a/webpack.conf.js +++ b/webpack.conf.js @@ -42,7 +42,7 @@ module.exports = { return entry; })(), output: { - chunkLoadingGlobal: prebid.globalVarName + 'Chunk', + chunkLoadingGlobal: (argv.profile === 'IH' ? prebid.ihGlobalVarName : prebid.globalVarName ) + 'Chunk', chunkLoading: 'jsonp', }, module: {