Skip to content

Commit

Permalink
Sync up Github repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ix-certification committed Mar 5, 2018
2 parents 5709201 + f58fac8 commit dd92cce
Show file tree
Hide file tree
Showing 3 changed files with 239 additions and 256 deletions.
24 changes: 14 additions & 10 deletions open-x-htb-exports.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
/**
* This file contains any necessary functions that need to be exposed to the outside world.
* Things like (render functions) will be exposed by adding them to the shellInterface variable, under the partners
* profile name. This function will then be accessible through the window.headertag.OpenXHtb object.
* If necessary for backwards compatibility with old creatives, you can also add things directly to the
* window namespace here, but this is discouraged if it's not strictly needed.
*/

//? if (FEATURES.GPT_LINE_ITEMS) {
shellInterface.OpenXHtb = {
render: SpaceCamp.services.RenderService.renderDfpAd.bind(null, 'OpenXHtb')
adResponseCallbacks: {}
}

//? if(FEATURES.GPT_LINE_ITEMS) {
shellInterface.OpenXHtb.render = SpaceCamp.services.RenderService.renderDfpAd.bind(null, 'OpenXHtb');

/* backwards-compatible alternate function name */
shellInterface.OpenXModule = {
render: shellInterface.OpenXHtb.render
};
//? }

if (__directInterface.Layers.PartnersLayer.Partners.OpenXHtb) {
shellInterface.OpenXHtb = shellInterface.OpenXHtb || {};
shellInterface.OpenXHtb.adResponseCallbacks = __directInterface.Layers.PartnersLayer.Partners.OpenXHtb.adResponseCallbacks;
}
60 changes: 47 additions & 13 deletions open-x-htb-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* prior written permission of Index Exchange.
*/


'use strict';

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -23,29 +22,64 @@ var Inspector = require('../../../libs/external/schema-inspector.js');
// Main ////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////


/* =============================================================================
* STEP 0 | Config Validation
* -----------------------------------------------------------------------------
* This file contains the necessary validation for the partner configuration.
* This validation will be performed on the partner specific configuration object
* that is passed into the wrapper. The wrapper uses an outside library called
* schema-insepctor to perform the validation. Information about it can be found here:
* https://atinux.fr/schema-inspector/.
*/
var partnerValidator = function (configs) {
var result = Inspector.validate({
type: 'object',
properties: {
host: {
type: 'string',
minLength: 1
},
medium: {
optional: true,
type: 'string',
minLength: 1
},
version: {
optional: true,
type: 'string',
minLength: 1
},
endPointName: {
optional: true,
type: 'string',
minLength: 1
},
charset: {
optional: true,
type: 'string',
minLength: 1
},
bidderCode: {
optional: true,
type: 'string',
minLength: 1
},
trackingEnabled: {
optional: true,
type: 'boolean'
},
xSlots: {
type: 'object',
properties: {
'*': {
type: 'object',
properties: {
placementId: {
adUnitId: {
type: 'string',
minLength: 1
},
sizes: {
type: 'array',
minLength: 1,
items: {
type: 'array',
exactLength: 2,
items: {
type: 'integer',
gte: 0
}
}
}
}
}
Expand All @@ -61,4 +95,4 @@ var partnerValidator = function (configs) {
return null;
};

module.exports = partnerValidator;
module.exports = partnerValidator;
Loading

0 comments on commit dd92cce

Please sign in to comment.