prebid-universal-creative 1.9.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/creative.js +3 -3
- package/dist/creative.max.js +86 -15
- package/dist/load-cookie-with-consent.html +1 -1
- package/dist/load-cookie.html +1 -1
- package/dist/native-render.js +3 -3
- package/dist/native-trk.js +3 -3
- package/dist/prebid-mobile-rewarded-vast.xml +22 -0
- package/dist/uid.js +2 -2
- package/gulpfile.js +9 -4
- package/package.json +1 -1
- package/src/cookieSync.js +27 -3
- package/src/cookieSyncWithConsent.js +46 -4
- package/src/renderingManager.js +64 -5
- package/src/utils.js +24 -15
- package/static/prebid-mobile-rewarded-vast.xml +22 -0
- package/test/spec/renderingManager_spec.js +84 -0
- package/testpages/amp_cookiesync.html +1 -1
- package/testpages/amp_cookiesync_with_consent.html +1 -1
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<VAST version="2.0">
|
3
|
+
<Ad id="PrebidMobileAppEvent">
|
4
|
+
<InLine>
|
5
|
+
<AdSystem version="1.0">Prebid org</AdSystem>
|
6
|
+
<AdTitle>PrebidAppEvent</AdTitle>
|
7
|
+
<Impression><![CDATA[https://test.url.com]]></Impression>
|
8
|
+
<Creatives>
|
9
|
+
<Creative>
|
10
|
+
<Linear>
|
11
|
+
<Duration>00:00:02</Duration>
|
12
|
+
<MediaFiles>
|
13
|
+
<MediaFile delivery="progressive" height="540" id="539733616" type="video/mp4" width="960">
|
14
|
+
<![CDATA[https://test.url.com/gam_rewarded.mp4]]>
|
15
|
+
</MediaFile>
|
16
|
+
</MediaFiles>
|
17
|
+
</Linear>
|
18
|
+
</Creative>
|
19
|
+
</Creatives>
|
20
|
+
</InLine>
|
21
|
+
</Ad>
|
22
|
+
</VAST>
|
@@ -4,6 +4,7 @@ import * as domHelper from 'src/domHelper';
|
|
4
4
|
import { expect } from 'chai';
|
5
5
|
import { mocks } from 'test/helpers/mocks';
|
6
6
|
import { merge } from 'lodash';
|
7
|
+
import * as postscribe from "postscribe";
|
7
8
|
|
8
9
|
const renderingMocks = {
|
9
10
|
messages: [],
|
@@ -159,6 +160,37 @@ describe('renderingManager', function() {
|
|
159
160
|
expect(writeHtmlSpy.callCount).to.equal(1);
|
160
161
|
expect(sendRequestSpy.args[0][0]).to.equal('https://prebid.adnxs.com/pbc/v1/cache?uuid=123');
|
161
162
|
});
|
163
|
+
|
164
|
+
// it('should catch errors from creative', function (done) {
|
165
|
+
// window.addEventListener('error', e => {
|
166
|
+
// done(e.error);
|
167
|
+
// });
|
168
|
+
|
169
|
+
// const consoleErrorSpy = sinon.spy(console, 'error');
|
170
|
+
|
171
|
+
// const renderObject = newRenderingManager(mockWin, env);
|
172
|
+
// let ucTagData = {
|
173
|
+
// cacheHost: 'example.com',
|
174
|
+
// cachePath: '/path',
|
175
|
+
// uuid: '123',
|
176
|
+
// size: '300x250'
|
177
|
+
// };
|
178
|
+
|
179
|
+
// renderObject.renderAd(mockWin.document, ucTagData);
|
180
|
+
|
181
|
+
// let response = {
|
182
|
+
// width: 300,
|
183
|
+
// height: 250,
|
184
|
+
// crid: 123,
|
185
|
+
// adm: '<script src="notExistingScript.js"></script>'
|
186
|
+
// };
|
187
|
+
// requests[0].respond(200, {}, JSON.stringify(response));
|
188
|
+
|
189
|
+
// setTimeout(()=>{
|
190
|
+
// expect(consoleErrorSpy.callCount).to.equal(1);
|
191
|
+
// done();
|
192
|
+
// }, 10);
|
193
|
+
// });
|
162
194
|
});
|
163
195
|
|
164
196
|
describe('amp creative', function() {
|
@@ -217,6 +249,58 @@ describe('renderingManager', function() {
|
|
217
249
|
expect(sendRequestSpy.args[0][0]).to.equal('https://example.com/path?uuid=123');
|
218
250
|
expect(triggerPixelSpy.args[0][0]).to.equal('https://test.prebidcache.wurl');
|
219
251
|
});
|
252
|
+
|
253
|
+
it('should replace AUCTION_PRICE with response.price over hbPb', function() {
|
254
|
+
const renderObject = newRenderingManager(mockWin, env);
|
255
|
+
|
256
|
+
let ucTagData = {
|
257
|
+
cacheHost: 'example.com',
|
258
|
+
cachePath: '/path',
|
259
|
+
uuid: '123',
|
260
|
+
size: '300x250',
|
261
|
+
hbPb: '10.00'
|
262
|
+
};
|
263
|
+
|
264
|
+
renderObject.renderAd(mockWin.document, ucTagData);
|
265
|
+
|
266
|
+
let response = {
|
267
|
+
width: 300,
|
268
|
+
height: 250,
|
269
|
+
crid: 123,
|
270
|
+
price: 12.50,
|
271
|
+
adm: 'ad-markup${AUCTION_PRICE}',
|
272
|
+
wurl: 'https://test.prebidcache.wurl'
|
273
|
+
};
|
274
|
+
requests[0].respond(200, {}, JSON.stringify(response));
|
275
|
+
expect(writeHtmlSpy.args[0][0]).to.equal('<!--Creative 123 served by Prebid.js Header Bidding-->ad-markup12.5');
|
276
|
+
expect(sendRequestSpy.args[0][0]).to.equal('https://example.com/path?uuid=123');
|
277
|
+
expect(triggerPixelSpy.args[0][0]).to.equal('https://test.prebidcache.wurl');
|
278
|
+
});
|
279
|
+
|
280
|
+
it('should replace AUCTION_PRICE with with empty value when neither price nor hbPb exist', function() {
|
281
|
+
const renderObject = newRenderingManager(mockWin, env);
|
282
|
+
|
283
|
+
let ucTagData = {
|
284
|
+
cacheHost: 'example.com',
|
285
|
+
cachePath: '/path',
|
286
|
+
uuid: '123',
|
287
|
+
size: '300x250'
|
288
|
+
};
|
289
|
+
|
290
|
+
renderObject.renderAd(mockWin.document, ucTagData);
|
291
|
+
|
292
|
+
let response = {
|
293
|
+
width: 300,
|
294
|
+
height: 250,
|
295
|
+
crid: 123,
|
296
|
+
adm: 'ad-markup${AUCTION_PRICE}',
|
297
|
+
wurl: 'https://test.prebidcache.wurl'
|
298
|
+
};
|
299
|
+
requests[0].respond(200, {}, JSON.stringify(response));
|
300
|
+
expect(writeHtmlSpy.args[0][0]).to.equal('<!--Creative 123 served by Prebid.js Header Bidding-->ad-markup');
|
301
|
+
expect(sendRequestSpy.args[0][0]).to.equal('https://example.com/path?uuid=123');
|
302
|
+
expect(triggerPixelSpy.args[0][0]).to.equal('https://test.prebidcache.wurl');
|
303
|
+
});
|
220
304
|
});
|
221
305
|
|
222
306
|
describe('cross domain creative', function() {
|
@@ -15,7 +15,7 @@
|
|
15
15
|
height="1"
|
16
16
|
sandbox="allow-scripts"
|
17
17
|
frameborder="0"
|
18
|
-
src="https://localhost:8080/dist/load-cookie.html?max_sync_count=1">
|
18
|
+
src="https://localhost:8080/dist/load-cookie.html?max_sync_count=1&source=amp">
|
19
19
|
<amp-img layout="fill" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" placeholder></amp-img>
|
20
20
|
</amp-iframe>
|
21
21
|
</body>
|
@@ -44,7 +44,7 @@
|
|
44
44
|
height="1"
|
45
45
|
sandbox="allow-scripts allow-same-origin allow-popups"
|
46
46
|
frameborder="0"
|
47
|
-
src="http://localhost:9990/dist/load-cookie-with-consent.html?max_sync_count=1"
|
47
|
+
src="http://localhost:9990/dist/load-cookie-with-consent.html?max_sync_count=1&source=amp"
|
48
48
|
layout="responsive">
|
49
49
|
<amp-img layout="fill" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" placeholder></amp-img>
|
50
50
|
</amp-iframe>
|