Skip to content

Commit

Permalink
Merge pull request #122 from MailOnline/next-release
Browse files Browse the repository at this point in the history
Next release
  • Loading branch information
carpasse authored Dec 13, 2018
2 parents bb0c49a + 963980e commit 1fc0852
Show file tree
Hide file tree
Showing 8 changed files with 749 additions and 4 deletions.
8 changes: 6 additions & 2 deletions fixtures/vast-inline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<VAST version="4.0">
<Ad id="abc123">
<InLine>
<Pricing model="cpm" currency="EUR">
<![CDATA[ 25.00 ]]>
</Pricing>
<AdServingId>ADID_INSIMPLETEST_ABC123</AdServingId>
<AdSystem version="1.0">MOL</AdSystem>
<AdTitle>VAST 4.0 Test</AdTitle>
<Error>https://test.example.com/error</Error>
Expand All @@ -19,8 +23,8 @@
</ViewableImpression>
<AdVerification/>
<Creatives>
<Creative adId="abc123" apiFramework="mol-api">
<UniversalAdId idValue="unknown">unknown</UniversalAdId>
<Creative adId="inline123" id="inline123" apiFramework="mol-api">
<UniversalAdId idRegistry="Ad-ID">8465</UniversalAdId>
<CreativeExtensions>
<CreativeExtension>
<Custom>this is custom stuff</Custom>
Expand Down
5 changes: 4 additions & 1 deletion fixtures/vast-wrapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
<VASTAdTagURI><![CDATA[https://test.example.com/vastadtaguri]]></VASTAdTagURI>
<Error><![CDATA[https://test.example.com/error/[ERRORCODE]]]></Error>
<Impression><![CDATA[https://test.example.com/impression]]></Impression>
<Pricing model="cpm" currency="USD">
<![CDATA[ 25.00 ]]>
</Pricing>
<Creatives>
<Creative sequence="1">
<Creative sequence="1" id="wrapper123" adId="wrapper123">
<Linear>
<TrackingEvents>
<Tracking event="start"><![CDATA[https://test.example.com/start]]></Tracking>
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import run from './runner/run';
import runWaterfall from './runner/runWaterfall';
import requestAd from './vastRequest/requestAd';
import requestNextAd from './vastRequest/requestNextAd';
import getDetails from './vastChain/getDetails';

export {
getDetails,
run,
runWaterfall,
requestAd,
Expand Down
48 changes: 48 additions & 0 deletions src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,51 @@
* @param {string} URLMacro - URL Macro that need to be tracked.
* @param {Object} data - data to use for the URL Macro.
*/

/**
* Object with the trafficking ad parameters and the xmlEncoded flag.
*
* @global
* @typedef creativeData
* @type Object
* @property {string} [AdParameters] - the AdParameters of the linear Ad as they come in the VAST XML.
* @property {boolean} [xmlEncoded] - true if the AdParameters are xml encoded and false otherwise
*/

/**
* {@link VastChain} details object. You can think of it as a summary of the VAST Chain. Useful for debugging purposes and tracking.
* for more info about the returned properties please check [VAST specification]{@link https://www.iab.com/guidelines/digital-video-ad-serving-template-vast-4-0/}
*
* @global
* @typedef VastChainDetails
* @type Object
* @property {string} [adId] - the ad Id. See VAST spec for more info
* @property {string} [adServingId] - the adServingId See VAST spec for more info
* @property {string} [adSystem] -- the ad system. See VAST spec for more info
* @property {string} [adTitle] - ad title.
* @property {string} [advertiser] - ad advertiser's name.
* @property {Array.<string>} [adWrapperCreativeAdIds] - creative ad ids of the wrapper.
* @property {Array.<string>} [adWrapperCreativeIds] - creative Ids of the wrappers.
* @property {Array.<string>} [adWrapperIds] - ad ids of the wrappers.
* @property {Array.<string>} [adWrapperSystems] - ad systems of the wrappers.
* @property {string} [category] - ad category.
* @property {string} [categoryAuthority] - ad category authority.
* @property {string} [clickThroughUrl] - the inline ad clickThroughUr.
* @property {string} [creativeAdId] - the ad id of the linear creative.
* @property {string} [creativeData] - Object with the {@link creativeData} of the Ad.
* @property {string} [creativeId] - the id of the linear creative.
* @property {string} [description] - ad description.
* @property {string} [duration] - the linear duration as it comes int the VAST XML
* @property {number} [durationInMs] - the linear duration in milliseconds
* @property {Array.<MediaFile>} [mediaFiles] - The linear ads {@link MediaFile}s
* @property {string} [pricing] - the pricing of the ad if available
* @property {string} [pricingCurrency] - the currency of the pricing if available.
* @property {string} [pricingModel] - the pricing model if available.
* @property {string} [skipOffset] - the linear skip offset as it comes int the VAST XML
* @property {number} [skipOffsetInMs] - the linear skip offset in milliseconds
* @property {boolean} [skippable] - true if the ad is skippable and false otherwise.
* @property {string} [universalAdId] - Universal Ad Id of the ad.
* @property {string} [universalAdIdRegistry] - registry of the Universal Ad Id of the ad.
* @property {string} vastVersion - VAST version of the last {@link VastResponse}. If no version is found it will contain `unknown`.
* @property {boolean} [vpaid] - if the VastChain has a linear ad, it will be true if it contains a VPAID creative and false otherwise.
*/
107 changes: 107 additions & 0 deletions src/vastChain/__tests__/__snapshots__/getDetails.spec.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`getDetails must return the media files 1`] = `
Array [
Object {
"apiFramework": undefined,
"bitrate": "600",
"codec": undefined,
"delivery": "progressive",
"height": "1080",
"id": undefined,
"maintainAspectRatio": "true",
"maxBitrate": undefined,
"minBitrate": undefined,
"scalable": "true",
"src": "https://test.example.com/test1920x1080.mp4",
"type": "video/mp4",
"universalAdId": "8465",
"width": "1920",
},
Object {
"apiFramework": undefined,
"bitrate": "600",
"codec": undefined,
"delivery": "progressive",
"height": "432",
"id": undefined,
"maintainAspectRatio": "true",
"maxBitrate": undefined,
"minBitrate": undefined,
"scalable": "true",
"src": "https://test.example.com/test768x432.mp4",
"type": "video/mp4",
"universalAdId": "8465",
"width": "768",
},
Object {
"apiFramework": undefined,
"bitrate": "600",
"codec": undefined,
"delivery": "progressive",
"height": "362",
"id": undefined,
"maintainAspectRatio": "true",
"maxBitrate": undefined,
"minBitrate": undefined,
"scalable": "true",
"src": "https://test.example.com/test640x362.mp4",
"type": "video/mp4",
"universalAdId": "8465",
"width": "640",
},
]
`;

exports[`getDetails must return the media files 2`] = `
Array [
Object {
"apiFramework": undefined,
"bitrate": "600",
"codec": undefined,
"delivery": "progressive",
"height": "1080",
"id": undefined,
"maintainAspectRatio": "true",
"maxBitrate": undefined,
"minBitrate": undefined,
"scalable": "true",
"src": "https://test.example.com/test1920x1080.mp4",
"type": "video/mp4",
"universalAdId": "8465",
"width": "1920",
},
Object {
"apiFramework": undefined,
"bitrate": "600",
"codec": undefined,
"delivery": "progressive",
"height": "432",
"id": undefined,
"maintainAspectRatio": "true",
"maxBitrate": undefined,
"minBitrate": undefined,
"scalable": "true",
"src": "https://test.example.com/test768x432.mp4",
"type": "video/mp4",
"universalAdId": "8465",
"width": "768",
},
Object {
"apiFramework": undefined,
"bitrate": "600",
"codec": undefined,
"delivery": "progressive",
"height": "362",
"id": undefined,
"maintainAspectRatio": "true",
"maxBitrate": undefined,
"minBitrate": undefined,
"scalable": "true",
"src": "https://test.example.com/test640x362.mp4",
"type": "video/mp4",
"universalAdId": "8465",
"width": "640",
},
]
`;
Loading

0 comments on commit 1fc0852

Please sign in to comment.