Skip to content

Commit

Permalink
Merge pull request #1 from dennisinteractive/feature/APP-1431-IAS-int…
Browse files Browse the repository at this point in the history
…egration

Feature/APP-1431: IAS integration
  • Loading branch information
Iliaspit authored Sep 24, 2020
2 parents 6d33d33 + f4609a2 commit b97972e
Show file tree
Hide file tree
Showing 10 changed files with 450 additions and 128 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: React GPT Forked Package

on:
release:
types: [created]

jobs:
publish-github-registry:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Configure the node version used on GitHub-hosted runners
uses: actions/setup-node@v1
with:
node-version: 10
registry-url: https://npm.pkg.github.com/
scope: '@dennisinteractive'
- name: Install dependencies
run: yarn install
- name: Run Tests
run: yarn test
- name: Build Test Package
if: contains(github.ref, 'test')
run: yarn build:umd
- name: Build Production
if: "!contains(github.ref, 'test')"
run: yarn build:umd:min
- name: Publish to Github Packages
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: yarn publish
1 change: 1 addition & 0 deletions docs/api/ReactGPT.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ A React component which renders [GPT](https://support.google.com/dfp_sb/answer/1
- `content`(optional) - An optional HTML content for the slot. If specified, the ad will render with the HTML content using content service.
- `clickUrl`(optional) - An optional click through URL. If specified, any landing page URL associated with the creative that is served is overridden.
- `categoryExclusion`(optional) - An optional string or an array of string which specifies a page-level ad category exclusion for the given label name.
- `displayCallback`(optional) - An optional callback function that gets passed from the siteapp. The callback allows to run code before `googletag.display()` (e.g. ias integration, amazon header bidding etc) and once this code is run, `googletag.display()` is eventually run.
- `attributes`(optional) - An optional map of key-value pairs for an AdSense attribute on a particular ad slot. see [the list of supported key value](https://developers.google.com/doubleclick-gpt/adsense_attributes#adsense_parameters.googletag.Slot)
- `collapseEmptyDiv`(optional) - An optional flag to indicate whether an empty ad should be collapsed or not.
- `forceSafeFrame`(optional) - An optional flag to indicate whether ads in this slot should be forced to be rendered using a SafeFrame container.
Expand Down
16 changes: 3 additions & 13 deletions karma.conf.ci.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
/* eslint-disable camelcase */
module.exports = function (config) {
config.set({
singleRun: true
});
process.env.CHROME_BIN = require("puppeteer").executablePath();

console.log("running default test on Chrome");
module.exports = function(config) {
config.set({
customLaunchers: {
Chrome_CI: {
base: "Chrome",
flags: ["--no-sandbox"]
}
},
browsers: ["Chrome_CI"]
browsers: ["ChromeHeadless"]
});
};
66 changes: 32 additions & 34 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var webpack = require("webpack");
module.exports = function (config) {
const webpack = require("webpack");
module.exports = function(config) {
config.set({
basePath: "",

Expand All @@ -11,46 +11,47 @@ module.exports = function (config) {
}
},

frameworks: [
"chai-sinon",
"mocha"
],
frameworks: ["chai-sinon", "mocha"],

files: [
"test/polyfill.js",
"test/**/*spec.js"
],
files: ["test/polyfill.js", "test/**/*spec.js"],

preprocessors: {
"test/polyfill.js": ["webpack"],
"test/**/*spec.js": ["webpack", "sourcemap"]
},

coverageReporter: {
reporters: [{
type: "html",
subdir: "html"
}, {
type: "text"
}, {
type: "lcovonly",
subdir: "."
}]
reporters: [
{
type: "html",
subdir: "html"
},
{
type: "text"
},
{
type: "lcovonly",
subdir: "."
}
]
},

webpack: {
devtool: "inline-source-map",
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel"
}, {
test: /\.js$/,
// exclude this dirs from coverage
exclude: /(test|node_modules)\//,
loader: "isparta"
}]
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel"
},
{
test: /\.js$/,
// exclude this dirs from coverage
exclude: /(test|node_modules)\//,
loader: "isparta"
}
]
},
resolve: {
extensions: ["", ".js"]
Expand All @@ -67,10 +68,7 @@ module.exports = function (config) {
noInfo: true
},

reporters: [
"mocha",
"coverage"
],
reporters: ["mocha", "coverage"],

port: 9876,

Expand All @@ -86,7 +84,7 @@ module.exports = function (config) {

singleRun: false
});

if (process.env.CI) {
require("./karma.conf.ci.js")(config);
}
Expand Down
32 changes: 26 additions & 6 deletions lib/Bling.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,18 +431,37 @@ var Bling = (_temp2 = _class = function (_Component) {
}, {
key: "display",
value: function display() {
var content = this.props.content;
var _props3 = this.props,
content = _props3.content,
displayCallback = _props3.displayCallback,
adUnitPath = _props3.adUnitPath;

var divId = this._divId;
var adSlot = this._adSlot;
var slotSize = this.getSlotSize();

if (content) {
Bling._adManager.googletag.content().setContent(adSlot, content);
} else {
if (!Bling._adManager._disableInitialLoad && !Bling._adManager._syncCorrelator) {
Bling._adManager.updateCorrelator();
}
Bling._adManager.googletag.display(divId);

if (typeof displayCallback === "function") {
displayCallback({
display: function display() {
return Bling._adManager.googletag.display(divId);
},
adSlotData: {
adUnitPath: adUnitPath,
size: slotSize,
adSlotId: divId
}
});
} else {
Bling._adManager.googletag.display(divId);
}

if (Bling._adManager._disableInitialLoad && !Bling._adManager._initialRender) {
this.refresh();
}
Expand Down Expand Up @@ -477,10 +496,10 @@ var Bling = (_temp2 = _class = function (_Component) {
key: "render",
value: function render() {
var scriptLoaded = this.state.scriptLoaded;
var _props3 = this.props,
id = _props3.id,
outOfPage = _props3.outOfPage,
style = _props3.style;
var _props4 = this.props,
id = _props4.id,
outOfPage = _props4.outOfPage,
style = _props4.style;

var shouldNotRender = this.notInViewport(this.props, this.state);

Expand Down Expand Up @@ -780,6 +799,7 @@ var Bling = (_temp2 = _class = function (_Component) {
* @property collapseEmptyDiv
*/
collapseEmptyDiv: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.array]),
displayCallback: _propTypes2.default.func,
/**
* An optional flag to indicate whether ads in this slot should be forced to be rendered using a SafeFrame container.
*
Expand Down
31 changes: 17 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dennisinteractive/react-gpt",
"version": "2.0.2",
"version": "2.1.0",
"description": "A react display ad component using Google Publisher Tag",
"main": "lib/index.js",
"jsnext:main": "es/index.js",
Expand Down Expand Up @@ -28,7 +28,14 @@
"bugs": {
"url": "https://github.com/dennisinteractive/react-gpt/issues"
},
"files": ["*.md", "docs", "es", "src", "dist", "lib"],
"files": [
"*.md",
"docs",
"es",
"src",
"dist",
"lib"
],
"dependencies": {
"deep-equal": "^1.0.1",
"eventemitter3": "^2.0.2",
Expand Down Expand Up @@ -67,7 +74,7 @@
"isparta-loader": "^2.0.0",
"karma": "^1.3.0",
"karma-chai-sinon": "^0.1.5",
"karma-chrome-launcher": "^2.0.0",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^1.0.1",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.2.0",
Expand All @@ -79,6 +86,7 @@
"phantom": "^2.0.4",
"prettier": "^1.9.2",
"prop-types": "^15.5.10",
"puppeteer": "^5.3.1",
"querystring": "^0.2.0",
"radium": "^0.18.1",
"react": "^16.0.0",
Expand All @@ -103,22 +111,17 @@
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"build": "npm run clean && npm run compile",
"build:es": "BABEL_ENV=es babel --copy-files ./src -d es",
"build:umd":
"NODE_ENV=development webpack src/index.js dist/react-gpt.js",
"build:umd:min":
"NODE_ENV=production webpack -p src/index.js dist/react-gpt.min.js",
"build:umd": "NODE_ENV=development webpack src/index.js dist/react-gpt.js",
"build:umd:min": "NODE_ENV=production webpack -p src/index.js dist/react-gpt.min.js",
"bundlesize": "npm run build:umd:min && bundlesize",
"clean": "rimraf lib coverage dist lib es",
"compile": "babel src --out-dir lib",
"examples":
"webpack-dev-server --config examples/webpack.config.js --content-base examples/apps --inline",
"examples": "webpack-dev-server --config examples/webpack.config.js --content-base examples/apps --inline",
"lint": "eslint --fix src test examples",
"start":
"npm run build && env BABEL_ENV=examples node examples/server/index.js",
"start": "npm run build && env BABEL_ENV=examples node examples/server/index.js",
"pretest": "npm run build",
"prepublish":
"npm run build && npm run build:es && npm run build:umd && npm run build:umd:min",
"test": "npm run lint && karma start",
"prepublish": "npm run build && npm run build:es && npm run build:umd && npm run build:umd:min",
"test": "npm run lint && karma start --single-run",
"update-apilist": "node ./scripts/updateAPIList.js"
},
"config": {
Expand Down
Loading

0 comments on commit b97972e

Please sign in to comment.