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

PFG-2532 update to 1.16.0 #5

Merged
merged 48 commits into from
May 2, 2024
Merged
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4066462
add support for catching errors from postscribe library (#129)
ibb-jile Aug 25, 2021
14e346c
Prebid Universal Creative 1.12.0 Release
jsnellbaker Aug 25, 2021
1b77ada
increment pre version
jsnellbaker Aug 25, 2021
6c65b1b
Static vast tag for mobile rendering API for rewarded video (#148)
YuriyVelichkoPI Dec 8, 2021
e0cd578
temporarily disable unit test (#149)
jsnellbaker Dec 8, 2021
eceb9eb
Prebid Universal Creative 1.13.0 Release
jsnellbaker Dec 9, 2021
320a6d1
increment pre version
jsnellbaker Dec 9, 2021
23d1f09
Signal AD_RENDER_FAILED / AD_RENDER_SUCCEEDED events to Prebid (#152)
dgirardi Jan 21, 2022
4d2ce42
Add issue tracking workflow: automatically create project items for n…
dgirardi Mar 11, 2022
37febf1
Upgrade dependencies make the build work on recent(ish) versions of N…
dgirardi Apr 7, 2022
c5f3ee8
Use MessageChannel for cross-frame messages (#154)
dgirardi Apr 25, 2022
2590307
readme: removed 'coming soon' message (#170)
bretg Jul 26, 2022
adc90f9
Remove <!doctype> from markup before rendering with postscribe (#172)
dgirardi Aug 31, 2022
724fdc7
Bump got from 11.8.3 to 11.8.5 (#169)
dependabot[bot] Aug 31, 2022
242b635
Bump copy-props from 2.0.4 to 2.0.5 (#163)
dependabot[bot] Aug 31, 2022
eed7b49
Bump tar from 4.4.8 to 4.4.19 (#162)
dependabot[bot] Aug 31, 2022
99d4c0e
Replace missing native assets with empty strings (#171)
anitaschiller Aug 31, 2022
b2410cb
Fix bugs / tests with empty string default for missing assets (#178)
dgirardi Sep 12, 2022
b53c299
Bump yargs-parser from 5.0.0 to 5.0.1 (#164)
dependabot[bot] Sep 12, 2022
68d81fc
Native ortb (#150)
FilipStamenkovic Sep 14, 2022
1d51de4
Bump engine.io and karma (#173)
dependabot[bot] Oct 19, 2022
cdcd4d5
Prebid Universal Creative 1.14.0 release
prebidjs-release Oct 26, 2022
45913cc
Increment version to 1.15.0-pre
prebidjs-release Oct 26, 2022
12f3d2e
Bump ejs and webdriverio (#184)
dependabot[bot] Oct 26, 2022
0d0ef04
Separate puc (#165)
musikele Oct 31, 2022
5b8f203
add buil-dev task (#189)
musikele Nov 21, 2022
ae1074b
make the project work with node latest; upgrade wdio (#188)
musikele Nov 28, 2022
1715042
Bump qs and body-parser (#197)
dependabot[bot] Jan 19, 2023
312e9f1
Bump decode-uri-component from 0.2.0 to 0.2.2 (#195)
dependabot[bot] Jan 19, 2023
bc001bf
Bump engine.io from 6.2.0 to 6.2.1 (#192)
dependabot[bot] Jan 19, 2023
f6c5cf3
hb_native_privicon (#194)
skoklowski Jan 19, 2023
3f969dc
Prebid Universal Creative 1.15.0 release
prebidjs-release Jan 19, 2023
d7b728c
Increment version to 1.16.0-pre
prebidjs-release Jan 19, 2023
4a86a23
Add macro to track clicks (#196)
musikele Jan 20, 2023
bd4801d
Update issue_tracker.yml for new GH API (#203)
dgirardi Feb 9, 2023
fbc5f4c
Replace all placeholders with the corresponding ortb assets (#211)
anitaschiller May 11, 2023
792f40e
Remove DOCTYPE from markup for app/amp/mobile (#210)
dgirardi May 17, 2023
1bfb498
Bump http-cache-semantics from 4.1.0 to 4.1.1 (#205)
dependabot[bot] Jun 21, 2023
5b195b5
Bump ua-parser-js from 0.7.32 to 0.7.33 (#202)
dependabot[bot] Jun 21, 2023
8502b32
Bump minimist, mkdirp, handlebars, karma-mocha and mocha (#207)
dependabot[bot] Jun 21, 2023
a323706
Bump socket.io-parser from 4.2.1 to 4.2.4 (#214)
dependabot[bot] Jun 21, 2023
5e8a24f
Improve resize logic for native (#193)
dgirardi Aug 28, 2023
8cbe9b1
Log error when renderAd lookup failed (#217)
Sir-Will Sep 7, 2023
52e066a
Emit AD_RENDER_SUCCEEDED and AD_RENDER_FAILED for native ads (#199)
dgirardi Sep 7, 2023
c6ba53b
Bump fsevents from 1.2.9 to 1.2.13 (#220)
dependabot[bot] Oct 11, 2023
580db41
Prebid Universal Creative 1.16.0 release
prebidjs-release Oct 12, 2023
4c66da3
Merge tag '1.16.0' into v.1.16.0
anastasiiapankivFS Jan 22, 2024
4b2ed23
re-applied freestar logic to new codebase
anastasiiapankivFS Jan 22, 2024
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
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -89,6 +89,17 @@ When we run `npm publish`, prepublish script of package.json is executed. Script

[jsDelivr](https://www.jsdelivr.com/) – Open Source CDN is used to serve creative.js file.

## Freestar Build For Staging and Production

`gulp build` is executed before publish. It creates following files in dist directory

+ `./dist/amp.js` - Minified amp.js source code (responsible for rendering amp ads)
+ `./dist/banner.js` - Minified banner.js source code (responsible for rendering banner ads)
+ `./dist/mobile.js` - Minified mobile.js source code (responsible for rendering mobile ads)
+ `./dist/native.js` - Minified native.js source code (responsible for rendering native ads)
+ `./dist/video.js` - Minified video.js source code (responsible for rendering outstream video ads)
[jsDelivr](https://www.jsdelivr.com/) – Open Source CDN is used to serve creative.js file.

## Freestar Deployment
```
$ bash bin/publish.sh
39 changes: 35 additions & 4 deletions bin/publish.sh
Original file line number Diff line number Diff line change
@@ -19,7 +19,13 @@ read -p "
If you are missing the dev-a sub domain that means you will be publishing to PRODUCTION.
Are you sure you're ready to publish the file prebid-universal-creative.js to $DOMAIN?" -n 1 -r
Are you sure you're ready to publish following files:
- prebid-universal-creative-amp.js
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open to suggestions about filenames

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are fine with me and in-line with our current naming convention.

When we test we just need to ensure these don't cause any issues as they will now be used as GAM key/values for substitutions. If we run into issues we will need to shorten the names.

- prebid-universal-creative-banner.js
- prebid-universal-creative-mobile.js
- prebid-universal-creative-native.js
- prebid-universal-creative-video.js
to $DOMAIN?" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo -e "${GREN}*** OKAY ***"
PARENT_DIRECTORY="$(dirname $( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) )"
@@ -28,10 +34,35 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
echo -e "${RED}*** DID YOU FORGET TO BUILD? ***${NC}"
exit 1
fi
FILE=$PARENT_DIRECTORY/dist/creative.js

FILE=$PARENT_DIRECTORY/dist/amp.js
echo -e "${GREEN}Built File ${FILE}"
gsutil mv $PARENT_DIRECTORY/dist/amp.js gs://$DOMAIN/core/prebid-universal-creative-amp.js
echo -e "${GREEN}Setting permissions for $FILE...${NC}"
gsutil acl ch -u AllUsers:R gs://$DOMAIN/core/prebid-universal-creative-amp.js

FILE=$PARENT_DIRECTORY/dist/banner.js
echo -e "${GREEN}Built File ${FILE}"
gsutil mv $PARENT_DIRECTORY/dist/banner.js gs://$DOMAIN/core/prebid-universal-creative-banner.js
echo -e "${GREEN}Setting permissions for $FILE...${NC}"
gsutil acl ch -u AllUsers:R gs://$DOMAIN/core/prebid-universal-creative-banner.js

FILE=$PARENT_DIRECTORY/dist/mobile.js
echo -e "${GREEN}Built File ${FILE}"
gsutil mv $PARENT_DIRECTORY/dist/mobile.js gs://$DOMAIN/core/prebid-universal-creative-mobile.js
echo -e "${GREEN}Setting permissions for $FILE...${NC}"
gsutil acl ch -u AllUsers:R gs://$DOMAIN/core/prebid-universal-creative-mobile.js

FILE=$PARENT_DIRECTORY/dist/native.js
echo -e "${GREEN}Built File ${FILE}"
gsutil mv $PARENT_DIRECTORY/dist/native.js gs://$DOMAIN/core/prebid-universal-creative-native.js
echo -e "${GREEN}Setting permissions for $FILE...${NC}"
gsutil acl ch -u AllUsers:R gs://$DOMAIN/core/prebid-universal-creative-native.js

FILE=$PARENT_DIRECTORY/dist/video.js
echo -e "${GREEN}Built File ${FILE}"
gsutil mv $PARENT_DIRECTORY/dist/creative.js gs://$DOMAIN/core/prebid-universal-creative.js
gsutil mv $PARENT_DIRECTORY/dist/video.js gs://$DOMAIN/core/prebid-universal-creative-video.js
echo -e "${GREEN}Setting permissions for $FILE...${NC}"
gsutil acl ch -u AllUsers:R gs://$DOMAIN/core/prebid-universal-creative.js
gsutil acl ch -u AllUsers:R gs://$DOMAIN/core/prebid-universal-creative-video.js
fi

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
"description": "Universal creative for Prebid apps",
"main": "dist/creative.js",
"scripts": {
"test": "echo test",
"test": "gulp test",
"prepublish": "gulp build"
},
"repository": {
10 changes: 7 additions & 3 deletions src/mobileAndAmpRender.js
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import { getCreativeCommentMarkup, triggerPixel, createTrackPixelHtml, loadScrip
import { isSafeFrame, isMobileApp } from './environment';
import { insertElement } from './domHelper';
import { writeAdHtml } from './postscribeRender';
import {appBidTrack, Freestar} from "./freestar";

const DEFAULT_CACHE_HOST = 'prebid.adnxs.com';
const DEFAULT_CACHE_PATH = '/pbc/v1/cache';
@@ -17,7 +18,8 @@ const DEFAULT_CACHE_PATH = '/pbc/v1/cache';
*/
export function renderAmpOrMobileAd(dataObject) {
const targetingData = transformAuctionTargetingData(dataObject);
let { cacheHost, cachePath, uuid, size, hbPb } = targetingData;
const freestar = new Freestar(targetingData);
let { cacheHost, cachePath, uuid, size, hbPb, env } = freestar;
uuid = uuid || '';
// For MoPub, creative is stored in localStorage via SDK.
let search = 'Prebid_';
@@ -29,7 +31,7 @@ export function renderAmpOrMobileAd(dataObject) {
let adUrl = `${getCacheEndpoint(cacheHost, cachePath)}?uuid=${uuid}`;
//register creative right away to not miss initial geom-update
updateIframe(size);
sendRequest(adUrl, responseCallback(isMobileApp(targetingData.env), hbPb));
sendRequest(adUrl, responseCallback(isMobileApp(env), hbPb, uuid));
}
}

@@ -102,13 +104,15 @@ function getCacheEndpoint(cacheHost, cachePath) {
* Cache request Callback to display creative
* @param {Bool} isMobileApp
* @param {string} hbPb final price of the winning bid
* @param {string} uuid
* @returns {function} a callback function that parses response
*/
function responseCallback(isMobileApp, hbPb) {
function responseCallback(isMobileApp, hbPb, uuid) {
return function (response) {
let bidObject = parseResponse(response);
let auctionPrice = bidObject.price || hbPb;
let ad = getCreativeCommentMarkup(bidObject);
appBidTrack(uuid);
let width = (bidObject.width) ? bidObject.width : bidObject.w;
let height = (bidObject.height) ? bidObject.height : bidObject.h;

6 changes: 4 additions & 2 deletions src/nativeTrackerManager.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
import { parseUrl, triggerPixel, transformAuctionTargetingData } from './utils';
import { newNativeAssetManager } from './nativeAssetManager';
import {prebidMessenger} from './messaging.js';
import {Freestar} from "./freestar";

const AD_ANCHOR_CLASS_NAME = 'pb-click';
const AD_DATA_ADID_ATTRIBUTE = 'pbAdId';
@@ -71,10 +72,11 @@ export function newNativeTrackerManager(win) {
// START OF MAIN CODE
let startTrackers = function (dataObject) {
const targetingData = transformAuctionTargetingData(dataObject);
const freestar = new Freestar(targetingData);
sendMessage = prebidMessenger(targetingData.pubUrl, win);
const nativeAssetManager = newNativeAssetManager(window, targetingData.pubUrl);

if (targetingData && targetingData.env === 'mobile-app') {
if (freestar && freestar.env === 'mobile-app') {
let cb = function({clickTrackers, impTrackers, eventtrackers} = {}) {
function loadMobileClickTrackers(clickTrackers) {
(clickTrackers || []).forEach(triggerPixel);
@@ -96,7 +98,7 @@ export function newNativeTrackerManager(win) {
.map(tracker => tracker.url)
.forEach(trackerUrl => loadScript(document, trackerUrl));
}
nativeAssetManager.loadMobileAssets(targetingData, cb);
nativeAssetManager.loadMobileAssets(freestar, cb);
} else {
let adElements = findAdElements(AD_ANCHOR_CLASS_NAME);

7 changes: 4 additions & 3 deletions src/renderingManager.js
Original file line number Diff line number Diff line change
@@ -2,14 +2,15 @@ import { parseUrl, transformAuctionTargetingData } from './utils';
import { canLocatePrebid } from './environment';
import { insertElement, getEmptyIframe } from './domHelper';
import {prebidMessenger} from './messaging.js';
import {Freestar} from "./freestar";

export function renderBannerOrDisplayAd(doc, dataObject) {
const targetingData = transformAuctionTargetingData(dataObject);

const freestar = new Freestar(targetingData);
if (!canLocatePrebid(window)) {
renderCrossDomain(window, targetingData.adId, targetingData.adServerDomain, targetingData.pubUrl);
renderCrossDomain(window, freestar.adId, targetingData.adServerDomain, targetingData.pubUrl);
} else {
renderLegacy(doc, targetingData.adId);
renderLegacy(doc, freestar.adId);
}
}