@mjhls/mjh-framework 1.0.7 → 1.0.8
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/index.es.js +1285 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1285 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.es.js
CHANGED
|
@@ -2,6 +2,7 @@ import React__default, { useContext, useMemo, Component, useCallback, useRef, us
|
|
|
2
2
|
import url from 'url';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
|
+
import events from 'events';
|
|
5
6
|
|
|
6
7
|
function _extends() {
|
|
7
8
|
_extends = Object.assign || function (target) {
|
|
@@ -11231,5 +11232,1288 @@ var Normal = function Normal(props) {
|
|
|
11231
11232
|
);
|
|
11232
11233
|
};
|
|
11233
11234
|
|
|
11234
|
-
|
|
11235
|
+
var utils$2 = createCommonjsModule(function (module, exports) {
|
|
11236
|
+
|
|
11237
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11238
|
+
value: true
|
|
11239
|
+
});
|
|
11240
|
+
exports.loadGPTScript = loadGPTScript;
|
|
11241
|
+
|
|
11242
|
+
function doloadGPTScript(resolve, reject) {
|
|
11243
|
+
window.googletag = window.googletag || {};
|
|
11244
|
+
window.googletag.cmd = window.googletag.cmd || [];
|
|
11245
|
+
var scriptTag = document.createElement('script');
|
|
11246
|
+
scriptTag.src = "".concat(document.location.protocol, "//securepubads.g.doubleclick.net/tag/js/gpt.js");
|
|
11247
|
+
scriptTag.async = true;
|
|
11248
|
+
scriptTag.type = 'text/javascript';
|
|
11249
|
+
|
|
11250
|
+
scriptTag.onerror = function scriptTagOnError(errs) {
|
|
11251
|
+
reject(errs);
|
|
11252
|
+
};
|
|
11253
|
+
|
|
11254
|
+
scriptTag.onload = function scriptTagOnLoad() {
|
|
11255
|
+
resolve(window.googletag);
|
|
11256
|
+
};
|
|
11257
|
+
|
|
11258
|
+
document.getElementsByTagName('head')[0].appendChild(scriptTag);
|
|
11259
|
+
}
|
|
11260
|
+
|
|
11261
|
+
function loadGPTScript() {
|
|
11262
|
+
return new Promise(function (resolve, reject) {
|
|
11263
|
+
doloadGPTScript(resolve, reject);
|
|
11264
|
+
});
|
|
11265
|
+
}
|
|
11266
|
+
});
|
|
11267
|
+
|
|
11268
|
+
unwrapExports(utils$2);
|
|
11269
|
+
var utils_1$1 = utils$2.loadGPTScript;
|
|
11270
|
+
|
|
11271
|
+
var manager = createCommonjsModule(function (module, exports) {
|
|
11272
|
+
|
|
11273
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11274
|
+
value: true
|
|
11275
|
+
});
|
|
11276
|
+
exports.default = void 0;
|
|
11277
|
+
|
|
11278
|
+
|
|
11279
|
+
|
|
11280
|
+
var Utils = _interopRequireWildcard(utils$2);
|
|
11281
|
+
|
|
11282
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
11283
|
+
|
|
11284
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
|
11285
|
+
|
|
11286
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11287
|
+
|
|
11288
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
11289
|
+
|
|
11290
|
+
var loadPromise = null;
|
|
11291
|
+
var googleGPTScriptLoadPromise = null;
|
|
11292
|
+
var singleRequestEnabled = true;
|
|
11293
|
+
var disableInitialLoadEnabled = false;
|
|
11294
|
+
var lazyLoadEnabled = false;
|
|
11295
|
+
var lazyLoadConfig = null;
|
|
11296
|
+
var servePersonalizedAds = true;
|
|
11297
|
+
var registeredSlots = {};
|
|
11298
|
+
var managerAlreadyInitialized = false;
|
|
11299
|
+
var globalTargetingArguments = {};
|
|
11300
|
+
var globalAdSenseAttributes = {};
|
|
11301
|
+
var DFPManager = Object.assign(new events.EventEmitter().setMaxListeners(0), {
|
|
11302
|
+
singleRequestIsEnabled: function singleRequestIsEnabled() {
|
|
11303
|
+
return singleRequestEnabled;
|
|
11304
|
+
},
|
|
11305
|
+
configureSingleRequest: function configureSingleRequest(value) {
|
|
11306
|
+
singleRequestEnabled = !!value;
|
|
11307
|
+
},
|
|
11308
|
+
disableInitialLoadIsEnabled: function disableInitialLoadIsEnabled() {
|
|
11309
|
+
return disableInitialLoadEnabled;
|
|
11310
|
+
},
|
|
11311
|
+
configureDisableInitialLoad: function configureDisableInitialLoad(value) {
|
|
11312
|
+
disableInitialLoadEnabled = !!value;
|
|
11313
|
+
},
|
|
11314
|
+
configureLazyLoad: function configureLazyLoad() {
|
|
11315
|
+
var enable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11316
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
11317
|
+
var conf = null;
|
|
11318
|
+
|
|
11319
|
+
if (config !== null && _typeof(config) === 'object') {
|
|
11320
|
+
conf = _objectSpread({}, config);
|
|
11321
|
+
}
|
|
11322
|
+
|
|
11323
|
+
lazyLoadEnabled = !!enable;
|
|
11324
|
+
lazyLoadConfig = conf;
|
|
11325
|
+
},
|
|
11326
|
+
lazyLoadIsEnabled: function lazyLoadIsEnabled() {
|
|
11327
|
+
return lazyLoadEnabled;
|
|
11328
|
+
},
|
|
11329
|
+
getLazyLoadConfig: function getLazyLoadConfig() {
|
|
11330
|
+
return lazyLoadConfig;
|
|
11331
|
+
},
|
|
11332
|
+
getAdSenseAttribute: function getAdSenseAttribute(key) {
|
|
11333
|
+
return globalAdSenseAttributes[key];
|
|
11334
|
+
},
|
|
11335
|
+
configurePersonalizedAds: function configurePersonalizedAds(value) {
|
|
11336
|
+
servePersonalizedAds = value;
|
|
11337
|
+
},
|
|
11338
|
+
personalizedAdsEnabled: function personalizedAdsEnabled() {
|
|
11339
|
+
return servePersonalizedAds;
|
|
11340
|
+
},
|
|
11341
|
+
setAdSenseAttribute: function setAdSenseAttribute(key, value) {
|
|
11342
|
+
this.setAdSenseAttributes(_defineProperty({}, key, value));
|
|
11343
|
+
},
|
|
11344
|
+
getAdSenseAttributes: function getAdSenseAttributes() {
|
|
11345
|
+
return _objectSpread({}, globalAdSenseAttributes);
|
|
11346
|
+
},
|
|
11347
|
+
setAdSenseAttributes: function setAdSenseAttributes(attrs) {
|
|
11348
|
+
Object.assign(globalAdSenseAttributes, attrs);
|
|
11349
|
+
|
|
11350
|
+
if (managerAlreadyInitialized === true) {
|
|
11351
|
+
this.getGoogletag().then(function (googletag) {
|
|
11352
|
+
googletag.cmd.push(function () {
|
|
11353
|
+
var pubadsService = googletag.pubads();
|
|
11354
|
+
Object.keys(globalAdSenseAttributes).forEach(function (key) {
|
|
11355
|
+
pubadsService.set(key, globalTargetingArguments[key]);
|
|
11356
|
+
});
|
|
11357
|
+
});
|
|
11358
|
+
});
|
|
11359
|
+
}
|
|
11360
|
+
},
|
|
11361
|
+
setTargetingArguments: function setTargetingArguments(data) {
|
|
11362
|
+
Object.assign(globalTargetingArguments, data);
|
|
11363
|
+
|
|
11364
|
+
if (managerAlreadyInitialized === true) {
|
|
11365
|
+
this.getGoogletag().then(function (googletag) {
|
|
11366
|
+
googletag.cmd.push(function () {
|
|
11367
|
+
var pubadsService = googletag.pubads();
|
|
11368
|
+
Object.keys(globalTargetingArguments).forEach(function (varName) {
|
|
11369
|
+
if (pubadsService) {
|
|
11370
|
+
pubadsService.setTargeting(varName, globalTargetingArguments[varName]);
|
|
11371
|
+
}
|
|
11372
|
+
});
|
|
11373
|
+
});
|
|
11374
|
+
});
|
|
11375
|
+
}
|
|
11376
|
+
},
|
|
11377
|
+
getTargetingArguments: function getTargetingArguments() {
|
|
11378
|
+
return _objectSpread({}, globalTargetingArguments);
|
|
11379
|
+
},
|
|
11380
|
+
getSlotProperty: function getSlotProperty(slotId, propName) {
|
|
11381
|
+
var slot = this.getRegisteredSlots()[slotId];
|
|
11382
|
+
var ret = null;
|
|
11383
|
+
|
|
11384
|
+
if (slot !== undefined) {
|
|
11385
|
+
ret = slot[propName] || ret;
|
|
11386
|
+
}
|
|
11387
|
+
|
|
11388
|
+
return ret;
|
|
11389
|
+
},
|
|
11390
|
+
getSlotTargetingArguments: function getSlotTargetingArguments(slotId) {
|
|
11391
|
+
var propValue = this.getSlotProperty(slotId, 'targetingArguments');
|
|
11392
|
+
return propValue ? _objectSpread({}, propValue) : null;
|
|
11393
|
+
},
|
|
11394
|
+
getSlotAdSenseAttributes: function getSlotAdSenseAttributes(slotId) {
|
|
11395
|
+
var propValue = this.getSlotProperty(slotId, 'adSenseAttributes');
|
|
11396
|
+
return propValue ? _objectSpread({}, propValue) : null;
|
|
11397
|
+
},
|
|
11398
|
+
init: function init() {
|
|
11399
|
+
var _this = this;
|
|
11400
|
+
|
|
11401
|
+
if (managerAlreadyInitialized === false) {
|
|
11402
|
+
managerAlreadyInitialized = true;
|
|
11403
|
+
this.getGoogletag().then(function (googletag) {
|
|
11404
|
+
googletag.cmd.push(function () {
|
|
11405
|
+
var pubadsService = googletag.pubads();
|
|
11406
|
+
pubadsService.addEventListener('slotRenderEnded', function (event) {
|
|
11407
|
+
var slotId = event.slot.getSlotElementId();
|
|
11408
|
+
|
|
11409
|
+
_this.emit('slotRenderEnded', {
|
|
11410
|
+
slotId: slotId,
|
|
11411
|
+
event: event
|
|
11412
|
+
});
|
|
11413
|
+
});
|
|
11414
|
+
pubadsService.addEventListener('impressionViewable', function (event) {
|
|
11415
|
+
var slotId = event.slot.getSlotElementId();
|
|
11416
|
+
|
|
11417
|
+
_this.emit('impressionViewable', {
|
|
11418
|
+
slotId: slotId,
|
|
11419
|
+
event: event
|
|
11420
|
+
});
|
|
11421
|
+
});
|
|
11422
|
+
pubadsService.addEventListener('slotVisibilityChanged', function (event) {
|
|
11423
|
+
var slotId = event.slot.getSlotElementId();
|
|
11424
|
+
|
|
11425
|
+
_this.emit('slotVisibilityChanged', {
|
|
11426
|
+
slotId: slotId,
|
|
11427
|
+
event: event
|
|
11428
|
+
});
|
|
11429
|
+
});
|
|
11430
|
+
pubadsService.setRequestNonPersonalizedAds(_this.personalizedAdsEnabled() ? 0 : 1);
|
|
11431
|
+
});
|
|
11432
|
+
});
|
|
11433
|
+
}
|
|
11434
|
+
},
|
|
11435
|
+
getGoogletag: function getGoogletag() {
|
|
11436
|
+
if (googleGPTScriptLoadPromise === null) {
|
|
11437
|
+
googleGPTScriptLoadPromise = Utils.loadGPTScript();
|
|
11438
|
+
}
|
|
11439
|
+
|
|
11440
|
+
return googleGPTScriptLoadPromise;
|
|
11441
|
+
},
|
|
11442
|
+
setCollapseEmptyDivs: function setCollapseEmptyDivs(collapse) {
|
|
11443
|
+
this.collapseEmptyDivs = collapse;
|
|
11444
|
+
},
|
|
11445
|
+
load: function load() {
|
|
11446
|
+
var _this2 = this;
|
|
11447
|
+
|
|
11448
|
+
for (var _len = arguments.length, slots = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11449
|
+
slots[_key] = arguments[_key];
|
|
11450
|
+
}
|
|
11451
|
+
|
|
11452
|
+
if (loadPromise === null) {
|
|
11453
|
+
loadPromise = this.doLoad.apply(this, slots);
|
|
11454
|
+
} else {
|
|
11455
|
+
loadPromise = loadPromise.then(function () {
|
|
11456
|
+
return _this2.doLoad.apply(_this2, slots);
|
|
11457
|
+
});
|
|
11458
|
+
}
|
|
11459
|
+
},
|
|
11460
|
+
doLoad: function doLoad() {
|
|
11461
|
+
this.init();
|
|
11462
|
+
var availableSlots = {};
|
|
11463
|
+
|
|
11464
|
+
for (var _len2 = arguments.length, slots = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
11465
|
+
slots[_key2] = arguments[_key2];
|
|
11466
|
+
}
|
|
11467
|
+
|
|
11468
|
+
if (slots.length > 0) {
|
|
11469
|
+
availableSlots = slots.filter(function (slotId) {
|
|
11470
|
+
return Object.prototype.hasOwnProperty.call(registeredSlots, slotId);
|
|
11471
|
+
});
|
|
11472
|
+
} else {
|
|
11473
|
+
availableSlots = Object.keys(registeredSlots);
|
|
11474
|
+
}
|
|
11475
|
+
|
|
11476
|
+
availableSlots = availableSlots.filter(function (id) {
|
|
11477
|
+
return !registeredSlots[id].loading && !registeredSlots[id].gptSlot;
|
|
11478
|
+
});
|
|
11479
|
+
availableSlots.forEach(function (slotId) {
|
|
11480
|
+
registeredSlots[slotId].loading = true;
|
|
11481
|
+
});
|
|
11482
|
+
return this.gptLoadAds(availableSlots);
|
|
11483
|
+
},
|
|
11484
|
+
gptLoadAds: function gptLoadAds(slotsToInitialize) {
|
|
11485
|
+
var _this3 = this;
|
|
11486
|
+
|
|
11487
|
+
return new Promise(function (resolve) {
|
|
11488
|
+
_this3.getGoogletag().then(function (googletag) {
|
|
11489
|
+
slotsToInitialize.forEach(function (currentSlotId) {
|
|
11490
|
+
registeredSlots[currentSlotId].loading = false;
|
|
11491
|
+
googletag.cmd.push(function () {
|
|
11492
|
+
var slot = registeredSlots[currentSlotId];
|
|
11493
|
+
var gptSlot;
|
|
11494
|
+
var adUnit = "".concat(slot.dfpNetworkId, "/").concat(slot.adUnit);
|
|
11495
|
+
|
|
11496
|
+
if (slot.renderOutOfThePage === true) {
|
|
11497
|
+
gptSlot = googletag.defineOutOfPageSlot(adUnit, currentSlotId);
|
|
11498
|
+
} else {
|
|
11499
|
+
gptSlot = googletag.defineSlot(adUnit, slot.sizes, currentSlotId);
|
|
11500
|
+
}
|
|
11501
|
+
|
|
11502
|
+
if (gptSlot !== null) {
|
|
11503
|
+
slot.gptSlot = gptSlot;
|
|
11504
|
+
|
|
11505
|
+
var slotTargetingArguments = _this3.getSlotTargetingArguments(currentSlotId);
|
|
11506
|
+
|
|
11507
|
+
if (slotTargetingArguments !== null) {
|
|
11508
|
+
Object.keys(slotTargetingArguments).forEach(function (varName) {
|
|
11509
|
+
if (slot && slot.gptSlot) {
|
|
11510
|
+
slot.gptSlot.setTargeting(varName, slotTargetingArguments[varName]);
|
|
11511
|
+
}
|
|
11512
|
+
});
|
|
11513
|
+
}
|
|
11514
|
+
|
|
11515
|
+
var slotAdSenseAttributes = _this3.getSlotAdSenseAttributes(currentSlotId);
|
|
11516
|
+
|
|
11517
|
+
if (slotAdSenseAttributes !== null) {
|
|
11518
|
+
Object.keys(slotAdSenseAttributes).forEach(function (varName) {
|
|
11519
|
+
slot.gptSlot.set(varName, slotAdSenseAttributes[varName]);
|
|
11520
|
+
});
|
|
11521
|
+
}
|
|
11522
|
+
|
|
11523
|
+
slot.gptSlot.addService(googletag.pubads());
|
|
11524
|
+
|
|
11525
|
+
if (slot.sizeMapping) {
|
|
11526
|
+
var smbuilder = googletag.sizeMapping();
|
|
11527
|
+
slot.sizeMapping.forEach(function (mapping) {
|
|
11528
|
+
smbuilder = smbuilder.addSize(mapping.viewport, mapping.sizes);
|
|
11529
|
+
});
|
|
11530
|
+
slot.gptSlot.defineSizeMapping(smbuilder.build());
|
|
11531
|
+
}
|
|
11532
|
+
}
|
|
11533
|
+
});
|
|
11534
|
+
});
|
|
11535
|
+
|
|
11536
|
+
_this3.configureOptions(googletag);
|
|
11537
|
+
|
|
11538
|
+
googletag.cmd.push(function () {
|
|
11539
|
+
googletag.enableServices();
|
|
11540
|
+
|
|
11541
|
+
if (!_this3.disableInitialLoadIsEnabled()) {
|
|
11542
|
+
slotsToInitialize.forEach(function (theSlotId) {
|
|
11543
|
+
googletag.display(theSlotId);
|
|
11544
|
+
});
|
|
11545
|
+
}
|
|
11546
|
+
|
|
11547
|
+
resolve();
|
|
11548
|
+
});
|
|
11549
|
+
});
|
|
11550
|
+
});
|
|
11551
|
+
},
|
|
11552
|
+
configureOptions: function configureOptions(googletag) {
|
|
11553
|
+
var _this4 = this;
|
|
11554
|
+
|
|
11555
|
+
googletag.cmd.push(function () {
|
|
11556
|
+
var pubadsService = googletag.pubads();
|
|
11557
|
+
pubadsService.setRequestNonPersonalizedAds(_this4.personalizedAdsEnabled() ? 0 : 1);
|
|
11558
|
+
|
|
11559
|
+
var targetingArguments = _this4.getTargetingArguments(); // set global targetting arguments
|
|
11560
|
+
|
|
11561
|
+
|
|
11562
|
+
Object.keys(targetingArguments).forEach(function (varName) {
|
|
11563
|
+
if (pubadsService) {
|
|
11564
|
+
pubadsService.setTargeting(varName, targetingArguments[varName]);
|
|
11565
|
+
}
|
|
11566
|
+
}); // set global adSense attributes
|
|
11567
|
+
|
|
11568
|
+
var adSenseAttributes = _this4.getAdSenseAttributes();
|
|
11569
|
+
|
|
11570
|
+
Object.keys(adSenseAttributes).forEach(function (key) {
|
|
11571
|
+
pubadsService.set(key, adSenseAttributes[key]);
|
|
11572
|
+
});
|
|
11573
|
+
|
|
11574
|
+
if (_this4.lazyLoadIsEnabled()) {
|
|
11575
|
+
var args = [];
|
|
11576
|
+
|
|
11577
|
+
var config = _this4.getLazyLoadConfig();
|
|
11578
|
+
|
|
11579
|
+
if (config !== null) {
|
|
11580
|
+
args.push(config);
|
|
11581
|
+
}
|
|
11582
|
+
|
|
11583
|
+
pubadsService.enableLazyLoad.call(args);
|
|
11584
|
+
}
|
|
11585
|
+
|
|
11586
|
+
if (_this4.singleRequestIsEnabled()) {
|
|
11587
|
+
pubadsService.enableSingleRequest();
|
|
11588
|
+
}
|
|
11589
|
+
|
|
11590
|
+
if (_this4.disableInitialLoadIsEnabled()) {
|
|
11591
|
+
pubadsService.disableInitialLoad();
|
|
11592
|
+
}
|
|
11593
|
+
|
|
11594
|
+
if (_this4.collapseEmptyDivs === true || _this4.collapseEmptyDivs === false) {
|
|
11595
|
+
pubadsService.collapseEmptyDivs(_this4.collapseEmptyDivs);
|
|
11596
|
+
}
|
|
11597
|
+
});
|
|
11598
|
+
},
|
|
11599
|
+
getRefreshableSlots: function getRefreshableSlots() {
|
|
11600
|
+
var slots = {};
|
|
11601
|
+
|
|
11602
|
+
for (var _len3 = arguments.length, slotsArray = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
11603
|
+
slotsArray[_key3] = arguments[_key3];
|
|
11604
|
+
}
|
|
11605
|
+
|
|
11606
|
+
if (slotsArray.length === 0) {
|
|
11607
|
+
var slotsToRefresh = Object.keys(registeredSlots).map(function (k) {
|
|
11608
|
+
return registeredSlots[k];
|
|
11609
|
+
});
|
|
11610
|
+
return slotsToRefresh.reduce(function (last, slot) {
|
|
11611
|
+
if (slot.slotShouldRefresh() === true) {
|
|
11612
|
+
slots[slot.slotId] = slot;
|
|
11613
|
+
}
|
|
11614
|
+
|
|
11615
|
+
return slots;
|
|
11616
|
+
}, slots);
|
|
11617
|
+
}
|
|
11618
|
+
|
|
11619
|
+
return slotsArray.reduce(function (last, slotId) {
|
|
11620
|
+
var slot = registeredSlots[slotId];
|
|
11621
|
+
|
|
11622
|
+
if (typeof slot !== 'undefined') {
|
|
11623
|
+
slots[slotId] = slot;
|
|
11624
|
+
}
|
|
11625
|
+
|
|
11626
|
+
return slots;
|
|
11627
|
+
}, slots);
|
|
11628
|
+
},
|
|
11629
|
+
refresh: function refresh() {
|
|
11630
|
+
if (loadPromise === null) {
|
|
11631
|
+
this.load();
|
|
11632
|
+
} else {
|
|
11633
|
+
this.gptRefreshAds(Object.keys(this.getRefreshableSlots.apply(this, arguments)));
|
|
11634
|
+
}
|
|
11635
|
+
},
|
|
11636
|
+
gptRefreshAds: function gptRefreshAds(slots) {
|
|
11637
|
+
var _this5 = this;
|
|
11638
|
+
|
|
11639
|
+
return this.getGoogletag().then(function (googletag) {
|
|
11640
|
+
_this5.configureOptions(googletag);
|
|
11641
|
+
|
|
11642
|
+
googletag.cmd.push(function () {
|
|
11643
|
+
var pubadsService = googletag.pubads();
|
|
11644
|
+
pubadsService.refresh(slots.map(function (slotId) {
|
|
11645
|
+
return registeredSlots[slotId].gptSlot;
|
|
11646
|
+
}));
|
|
11647
|
+
});
|
|
11648
|
+
});
|
|
11649
|
+
},
|
|
11650
|
+
reload: function reload() {
|
|
11651
|
+
var _this6 = this;
|
|
11652
|
+
|
|
11653
|
+
return this.destroyGPTSlots.apply(this, arguments).then(function () {
|
|
11654
|
+
return _this6.load();
|
|
11655
|
+
});
|
|
11656
|
+
},
|
|
11657
|
+
destroyGPTSlots: function destroyGPTSlots() {
|
|
11658
|
+
var _this7 = this;
|
|
11659
|
+
|
|
11660
|
+
for (var _len4 = arguments.length, slotsToDestroy = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
11661
|
+
slotsToDestroy[_key4] = arguments[_key4];
|
|
11662
|
+
}
|
|
11663
|
+
|
|
11664
|
+
if (slotsToDestroy.length === 0) {
|
|
11665
|
+
// eslint-disable-next-line no-param-reassign
|
|
11666
|
+
slotsToDestroy = Object.keys(registeredSlots);
|
|
11667
|
+
}
|
|
11668
|
+
|
|
11669
|
+
return new Promise(function (resolve) {
|
|
11670
|
+
var slots = []; // eslint-disable-next-line guard-for-in,no-restricted-syntax
|
|
11671
|
+
|
|
11672
|
+
for (var idx in slotsToDestroy) {
|
|
11673
|
+
var slotId = slotsToDestroy[idx];
|
|
11674
|
+
var slot = registeredSlots[slotId];
|
|
11675
|
+
slots.push(slot);
|
|
11676
|
+
}
|
|
11677
|
+
|
|
11678
|
+
_this7.getGoogletag().then(function (googletag) {
|
|
11679
|
+
googletag.cmd.push(function () {
|
|
11680
|
+
if (managerAlreadyInitialized === true) {
|
|
11681
|
+
if (slotsToDestroy.length > 0) {
|
|
11682
|
+
// eslint-disable-next-line guard-for-in,no-restricted-syntax
|
|
11683
|
+
for (var _idx in slots) {
|
|
11684
|
+
var _slot = slots[_idx];
|
|
11685
|
+
slots.push(_slot.gptSlot);
|
|
11686
|
+
delete _slot.gptSlot;
|
|
11687
|
+
}
|
|
11688
|
+
|
|
11689
|
+
googletag.destroySlots(slots);
|
|
11690
|
+
} else {
|
|
11691
|
+
googletag.destroySlots();
|
|
11692
|
+
}
|
|
11693
|
+
}
|
|
11694
|
+
|
|
11695
|
+
resolve(slotsToDestroy);
|
|
11696
|
+
});
|
|
11697
|
+
});
|
|
11698
|
+
});
|
|
11699
|
+
},
|
|
11700
|
+
registerSlot: function registerSlot(_ref) {
|
|
11701
|
+
var _this8 = this;
|
|
11702
|
+
|
|
11703
|
+
var slotId = _ref.slotId,
|
|
11704
|
+
dfpNetworkId = _ref.dfpNetworkId,
|
|
11705
|
+
adUnit = _ref.adUnit,
|
|
11706
|
+
sizes = _ref.sizes,
|
|
11707
|
+
renderOutOfThePage = _ref.renderOutOfThePage,
|
|
11708
|
+
sizeMapping = _ref.sizeMapping,
|
|
11709
|
+
adSenseAttributes = _ref.adSenseAttributes,
|
|
11710
|
+
targetingArguments = _ref.targetingArguments,
|
|
11711
|
+
slotShouldRefresh = _ref.slotShouldRefresh;
|
|
11712
|
+
var autoLoad = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
11713
|
+
|
|
11714
|
+
if (!Object.prototype.hasOwnProperty.call(registeredSlots, slotId)) {
|
|
11715
|
+
registeredSlots[slotId] = {
|
|
11716
|
+
slotId: slotId,
|
|
11717
|
+
sizes: sizes,
|
|
11718
|
+
renderOutOfThePage: renderOutOfThePage,
|
|
11719
|
+
dfpNetworkId: dfpNetworkId,
|
|
11720
|
+
adUnit: adUnit,
|
|
11721
|
+
adSenseAttributes: adSenseAttributes,
|
|
11722
|
+
targetingArguments: targetingArguments,
|
|
11723
|
+
sizeMapping: sizeMapping,
|
|
11724
|
+
slotShouldRefresh: slotShouldRefresh,
|
|
11725
|
+
loading: false
|
|
11726
|
+
};
|
|
11727
|
+
this.emit('slotRegistered', {
|
|
11728
|
+
slotId: slotId
|
|
11729
|
+
});
|
|
11730
|
+
|
|
11731
|
+
if (autoLoad === true && loadPromise !== null) {
|
|
11732
|
+
loadPromise = loadPromise.catch().then(function () {
|
|
11733
|
+
var slot = registeredSlots[slotId];
|
|
11734
|
+
|
|
11735
|
+
if (typeof slot !== 'undefined') {
|
|
11736
|
+
var loading = slot.loading,
|
|
11737
|
+
gptSlot = slot.gptSlot;
|
|
11738
|
+
|
|
11739
|
+
if (loading === false && !gptSlot) {
|
|
11740
|
+
_this8.load(slotId);
|
|
11741
|
+
}
|
|
11742
|
+
}
|
|
11743
|
+
});
|
|
11744
|
+
}
|
|
11745
|
+
}
|
|
11746
|
+
},
|
|
11747
|
+
unregisterSlot: function unregisterSlot(_ref2) {
|
|
11748
|
+
var slotId = _ref2.slotId;
|
|
11749
|
+
this.destroyGPTSlots(slotId);
|
|
11750
|
+
delete registeredSlots[slotId];
|
|
11751
|
+
},
|
|
11752
|
+
getRegisteredSlots: function getRegisteredSlots() {
|
|
11753
|
+
return registeredSlots;
|
|
11754
|
+
},
|
|
11755
|
+
attachSlotRenderEnded: function attachSlotRenderEnded(cb) {
|
|
11756
|
+
this.on('slotRenderEnded', cb);
|
|
11757
|
+
},
|
|
11758
|
+
detachSlotRenderEnded: function detachSlotRenderEnded(cb) {
|
|
11759
|
+
this.removeListener('slotRenderEnded', cb);
|
|
11760
|
+
},
|
|
11761
|
+
attachSlotVisibilityChanged: function attachSlotVisibilityChanged(cb) {
|
|
11762
|
+
this.on('slotVisibilityChanged', cb);
|
|
11763
|
+
},
|
|
11764
|
+
detachSlotVisibilityChanged: function detachSlotVisibilityChanged(cb) {
|
|
11765
|
+
this.removeListener('slotVisibilityChanged', cb);
|
|
11766
|
+
},
|
|
11767
|
+
attachSlotIsViewable: function attachSlotIsViewable(cb) {
|
|
11768
|
+
this.on('impressionViewable', cb);
|
|
11769
|
+
},
|
|
11770
|
+
detachSlotIsViewable: function detachSlotIsViewable(cb) {
|
|
11771
|
+
this.removeListener('impressionViewable', cb);
|
|
11772
|
+
}
|
|
11773
|
+
});
|
|
11774
|
+
var _default = DFPManager;
|
|
11775
|
+
exports.default = _default;
|
|
11776
|
+
});
|
|
11777
|
+
|
|
11778
|
+
unwrapExports(manager);
|
|
11779
|
+
|
|
11780
|
+
var dfpslotsprovider = createCommonjsModule(function (module, exports) {
|
|
11781
|
+
|
|
11782
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11783
|
+
value: true
|
|
11784
|
+
});
|
|
11785
|
+
exports.default = exports.Context = void 0;
|
|
11786
|
+
|
|
11787
|
+
var _react = _interopRequireDefault(React__default);
|
|
11788
|
+
|
|
11789
|
+
var _propTypes = _interopRequireDefault(PropTypes);
|
|
11790
|
+
|
|
11791
|
+
var _manager = _interopRequireDefault(manager);
|
|
11792
|
+
|
|
11793
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11794
|
+
|
|
11795
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
11796
|
+
|
|
11797
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11798
|
+
|
|
11799
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11800
|
+
|
|
11801
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
11802
|
+
|
|
11803
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
11804
|
+
|
|
11805
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
11806
|
+
|
|
11807
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
11808
|
+
|
|
11809
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
11810
|
+
|
|
11811
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
11812
|
+
|
|
11813
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11814
|
+
|
|
11815
|
+
// React.createContext is undefined for React < 16.3
|
|
11816
|
+
var Context = _react.default.createContext ? _react.default.createContext({
|
|
11817
|
+
dfpNetworkId: null,
|
|
11818
|
+
dfpAdUnit: null,
|
|
11819
|
+
dfpSizeMapping: null,
|
|
11820
|
+
dfpTargetingArguments: null,
|
|
11821
|
+
newSlotCallback: null
|
|
11822
|
+
}) : null;
|
|
11823
|
+
exports.Context = Context;
|
|
11824
|
+
|
|
11825
|
+
var DFPSlotsProvider =
|
|
11826
|
+
/*#__PURE__*/
|
|
11827
|
+
function (_React$Component) {
|
|
11828
|
+
_inherits(DFPSlotsProvider, _React$Component);
|
|
11829
|
+
|
|
11830
|
+
function DFPSlotsProvider(props) {
|
|
11831
|
+
var _this;
|
|
11832
|
+
|
|
11833
|
+
_classCallCheck(this, DFPSlotsProvider);
|
|
11834
|
+
|
|
11835
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(DFPSlotsProvider).call(this, props));
|
|
11836
|
+
_this.loadAdsIfPossible = _this.loadAdsIfPossible.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
11837
|
+
_this.newSlotCallback = _this.newSlotCallback.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
11838
|
+
_this.applyConfigs = _this.applyConfigs.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
11839
|
+
_this.shouldReloadConfig = _this.shouldReloadConfig.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
11840
|
+
_this.attachLoadCallback = _this.attachLoadCallback.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
11841
|
+
_this.getContextValue = _this.getContextValue.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
11842
|
+
_this.loadAlreadyCalled = false;
|
|
11843
|
+
_this.loadCallbackAttached = false;
|
|
11844
|
+
_this.shouldReloadAds = false;
|
|
11845
|
+
_this.totalSlots = 0;
|
|
11846
|
+
_this.contextValue = {};
|
|
11847
|
+
|
|
11848
|
+
if (Context === null) {
|
|
11849
|
+
_this.getChildContext = function () {
|
|
11850
|
+
return _this.getContextValue();
|
|
11851
|
+
};
|
|
11852
|
+
}
|
|
11853
|
+
|
|
11854
|
+
return _this;
|
|
11855
|
+
}
|
|
11856
|
+
|
|
11857
|
+
_createClass(DFPSlotsProvider, [{
|
|
11858
|
+
key: "componentDidMount",
|
|
11859
|
+
value: function componentDidMount() {
|
|
11860
|
+
this.applyConfigs();
|
|
11861
|
+
|
|
11862
|
+
if (this.props.autoLoad && !this.loadAdsIfPossible()) {
|
|
11863
|
+
this.attachLoadCallback();
|
|
11864
|
+
}
|
|
11865
|
+
}
|
|
11866
|
+
}, {
|
|
11867
|
+
key: "shouldComponentUpdate",
|
|
11868
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
11869
|
+
this.shouldReloadAds = this.shouldReloadConfig(nextProps);
|
|
11870
|
+
|
|
11871
|
+
if (nextProps.children !== this.props.children) {
|
|
11872
|
+
return true;
|
|
11873
|
+
}
|
|
11874
|
+
|
|
11875
|
+
if (nextProps.autoLoad && !this.props.autoLoad) {
|
|
11876
|
+
return true;
|
|
11877
|
+
}
|
|
11878
|
+
|
|
11879
|
+
return this.shouldReloadAds;
|
|
11880
|
+
}
|
|
11881
|
+
}, {
|
|
11882
|
+
key: "componentDidUpdate",
|
|
11883
|
+
value: function componentDidUpdate() {
|
|
11884
|
+
this.applyConfigs();
|
|
11885
|
+
|
|
11886
|
+
if (this.props.autoLoad) {
|
|
11887
|
+
if (this.loadAlreadyCalled) {
|
|
11888
|
+
if (this.shouldReloadAds) {
|
|
11889
|
+
_manager.default.reload();
|
|
11890
|
+
}
|
|
11891
|
+
} else if (!this.loadAdsIfPossible()) {
|
|
11892
|
+
this.attachLoadCallback();
|
|
11893
|
+
}
|
|
11894
|
+
}
|
|
11895
|
+
|
|
11896
|
+
this.shouldReloadAds = false;
|
|
11897
|
+
}
|
|
11898
|
+
}, {
|
|
11899
|
+
key: "getContextValue",
|
|
11900
|
+
value: function getContextValue() {
|
|
11901
|
+
var _this$props = this.props,
|
|
11902
|
+
dfpNetworkId = _this$props.dfpNetworkId,
|
|
11903
|
+
dfpAdUnit = _this$props.adUnit,
|
|
11904
|
+
dfpSizeMapping = _this$props.sizeMapping,
|
|
11905
|
+
dfpTargetingArguments = _this$props.targetingArguments,
|
|
11906
|
+
_this$contextValue = this.contextValue,
|
|
11907
|
+
ctxDfpNetworkId = _this$contextValue.dfpNetworkId,
|
|
11908
|
+
ctxDfpAdUnit = _this$contextValue.adUnit,
|
|
11909
|
+
ctxDfpSizeMapping = _this$contextValue.sizeMapping,
|
|
11910
|
+
ctxDfpTargetingArguments = _this$contextValue.targetingArguments; // performance: update context value object only when any of its
|
|
11911
|
+
// props is updated.
|
|
11912
|
+
|
|
11913
|
+
if (dfpNetworkId !== ctxDfpNetworkId || dfpAdUnit !== ctxDfpAdUnit || dfpSizeMapping !== ctxDfpSizeMapping || dfpTargetingArguments !== ctxDfpTargetingArguments) {
|
|
11914
|
+
this.contextValue = {
|
|
11915
|
+
dfpNetworkId: dfpNetworkId,
|
|
11916
|
+
dfpAdUnit: dfpAdUnit,
|
|
11917
|
+
dfpSizeMapping: dfpSizeMapping,
|
|
11918
|
+
dfpTargetingArguments: dfpTargetingArguments,
|
|
11919
|
+
newSlotCallback: this.newSlotCallback
|
|
11920
|
+
};
|
|
11921
|
+
}
|
|
11922
|
+
|
|
11923
|
+
return this.contextValue;
|
|
11924
|
+
}
|
|
11925
|
+
}, {
|
|
11926
|
+
key: "applyConfigs",
|
|
11927
|
+
value: function applyConfigs() {
|
|
11928
|
+
_manager.default.configurePersonalizedAds(this.props.personalizedAds);
|
|
11929
|
+
|
|
11930
|
+
_manager.default.configureSingleRequest(this.props.singleRequest);
|
|
11931
|
+
|
|
11932
|
+
_manager.default.configureDisableInitialLoad(this.props.disableInitialLoad);
|
|
11933
|
+
|
|
11934
|
+
_manager.default.configureLazyLoad(!!this.props.lazyLoad, typeof this.props.lazyLoad === 'boolean' ? null : this.props.lazyLoad);
|
|
11935
|
+
|
|
11936
|
+
_manager.default.setAdSenseAttributes(this.props.adSenseAttributes);
|
|
11937
|
+
|
|
11938
|
+
_manager.default.setCollapseEmptyDivs(this.props.collapseEmptyDivs);
|
|
11939
|
+
}
|
|
11940
|
+
}, {
|
|
11941
|
+
key: "attachLoadCallback",
|
|
11942
|
+
value: function attachLoadCallback() {
|
|
11943
|
+
if (this.loadCallbackAttached === false) {
|
|
11944
|
+
_manager.default.on('slotRegistered', this.loadAdsIfPossible);
|
|
11945
|
+
|
|
11946
|
+
this.loadCallbackAttached = true;
|
|
11947
|
+
return true;
|
|
11948
|
+
}
|
|
11949
|
+
|
|
11950
|
+
return false;
|
|
11951
|
+
} // pretty strait-forward interface that children ad slots use to register
|
|
11952
|
+
// with their DFPSlotProvider parent node.
|
|
11953
|
+
|
|
11954
|
+
}, {
|
|
11955
|
+
key: "newSlotCallback",
|
|
11956
|
+
value: function newSlotCallback() {
|
|
11957
|
+
this.totalSlots++;
|
|
11958
|
+
} // Checks all the mounted children ads have been already registered
|
|
11959
|
+
// in the DFPManager before trying to call the gpt load scripts.
|
|
11960
|
+
// This is helpful when trying to fetch ads with a single request.
|
|
11961
|
+
|
|
11962
|
+
}, {
|
|
11963
|
+
key: "loadAdsIfPossible",
|
|
11964
|
+
value: function loadAdsIfPossible() {
|
|
11965
|
+
var r = false;
|
|
11966
|
+
|
|
11967
|
+
if (Object.keys(_manager.default.getRegisteredSlots()).length >= this.totalSlots) {
|
|
11968
|
+
_manager.default.removeListener('slotRegistered', this.loadAdsIfPossible);
|
|
11969
|
+
|
|
11970
|
+
_manager.default.load();
|
|
11971
|
+
|
|
11972
|
+
this.loadAlreadyCalled = true;
|
|
11973
|
+
this.loadCallbackAttached = false;
|
|
11974
|
+
r = true;
|
|
11975
|
+
}
|
|
11976
|
+
|
|
11977
|
+
return r;
|
|
11978
|
+
}
|
|
11979
|
+
}, {
|
|
11980
|
+
key: "shouldReloadConfig",
|
|
11981
|
+
value: function shouldReloadConfig(nextProps) {
|
|
11982
|
+
var reloadConfig = nextProps.autoReload || this.props.autoReload;
|
|
11983
|
+
|
|
11984
|
+
if (this.props.autoLoad || nextProps.autoLoad) {
|
|
11985
|
+
if (_typeof(reloadConfig) === 'object') {
|
|
11986
|
+
var attrs = Object.keys(reloadConfig); // eslint-disable-next-line guard-for-in, no-restricted-syntax
|
|
11987
|
+
|
|
11988
|
+
for (var i in attrs) {
|
|
11989
|
+
var propName = attrs[i]; // eslint-disable-next-line
|
|
11990
|
+
|
|
11991
|
+
if (reloadConfig[propName] === true && this.props[propName] !== nextProps[propName]) {
|
|
11992
|
+
return true;
|
|
11993
|
+
}
|
|
11994
|
+
}
|
|
11995
|
+
}
|
|
11996
|
+
}
|
|
11997
|
+
|
|
11998
|
+
return false;
|
|
11999
|
+
}
|
|
12000
|
+
}, {
|
|
12001
|
+
key: "render",
|
|
12002
|
+
value: function render() {
|
|
12003
|
+
var children = this.props.children;
|
|
12004
|
+
|
|
12005
|
+
if (Context === null) {
|
|
12006
|
+
return children;
|
|
12007
|
+
}
|
|
12008
|
+
|
|
12009
|
+
return _react.default.createElement(Context.Provider, {
|
|
12010
|
+
value: this.getContextValue()
|
|
12011
|
+
}, children);
|
|
12012
|
+
}
|
|
12013
|
+
}]);
|
|
12014
|
+
|
|
12015
|
+
return DFPSlotsProvider;
|
|
12016
|
+
}(_react.default.Component);
|
|
12017
|
+
|
|
12018
|
+
exports.default = DFPSlotsProvider;
|
|
12019
|
+
|
|
12020
|
+
_defineProperty(DFPSlotsProvider, "propTypes", {
|
|
12021
|
+
children: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.array]).isRequired,
|
|
12022
|
+
autoLoad: _propTypes.default.bool,
|
|
12023
|
+
autoReload: _propTypes.default.shape({
|
|
12024
|
+
dfpNetworkId: _propTypes.default.bool,
|
|
12025
|
+
personalizedAds: _propTypes.default.bool,
|
|
12026
|
+
singleRequest: _propTypes.default.bool,
|
|
12027
|
+
disableInitialLoad: _propTypes.default.bool,
|
|
12028
|
+
adUnit: _propTypes.default.bool,
|
|
12029
|
+
sizeMapping: _propTypes.default.bool,
|
|
12030
|
+
adSenseAttributes: _propTypes.default.bool,
|
|
12031
|
+
targetingArguments: _propTypes.default.bool,
|
|
12032
|
+
collapseEmptyDivs: _propTypes.default.bool,
|
|
12033
|
+
lazyLoad: _propTypes.default.bool
|
|
12034
|
+
}),
|
|
12035
|
+
dfpNetworkId: _propTypes.default.string.isRequired,
|
|
12036
|
+
personalizedAds: _propTypes.default.bool,
|
|
12037
|
+
singleRequest: _propTypes.default.bool,
|
|
12038
|
+
disableInitialLoad: _propTypes.default.bool,
|
|
12039
|
+
adUnit: _propTypes.default.string,
|
|
12040
|
+
sizeMapping: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
12041
|
+
adSenseAttributes: _propTypes.default.object,
|
|
12042
|
+
targetingArguments: _propTypes.default.object,
|
|
12043
|
+
collapseEmptyDivs: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.object]),
|
|
12044
|
+
adSenseAttrs: _propTypes.default.object,
|
|
12045
|
+
lazyLoad: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.shape({
|
|
12046
|
+
fetchMarginPercent: _propTypes.default.number,
|
|
12047
|
+
renderMarginPercent: _propTypes.default.number,
|
|
12048
|
+
mobileScaling: _propTypes.default.number
|
|
12049
|
+
})])
|
|
12050
|
+
});
|
|
12051
|
+
|
|
12052
|
+
_defineProperty(DFPSlotsProvider, "defaultProps", {
|
|
12053
|
+
autoLoad: true,
|
|
12054
|
+
autoReload: {
|
|
12055
|
+
dfpNetworkId: false,
|
|
12056
|
+
personalizedAds: false,
|
|
12057
|
+
singleRequest: false,
|
|
12058
|
+
disableInitialLoad: false,
|
|
12059
|
+
adUnit: false,
|
|
12060
|
+
sizeMapping: false,
|
|
12061
|
+
adSenseAttributes: false,
|
|
12062
|
+
targetingArguments: false,
|
|
12063
|
+
collapseEmptyDivs: false,
|
|
12064
|
+
lazyLoad: false
|
|
12065
|
+
},
|
|
12066
|
+
personalizedAds: true,
|
|
12067
|
+
singleRequest: true,
|
|
12068
|
+
disableInitialLoad: false,
|
|
12069
|
+
collapseEmptyDivs: null,
|
|
12070
|
+
lazyLoad: false
|
|
12071
|
+
});
|
|
12072
|
+
|
|
12073
|
+
if (Context === null) {
|
|
12074
|
+
// React < 16.3
|
|
12075
|
+
DFPSlotsProvider.childContextTypes = {
|
|
12076
|
+
dfpNetworkId: _propTypes.default.string,
|
|
12077
|
+
dfpAdUnit: _propTypes.default.string,
|
|
12078
|
+
dfpSizeMapping: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
12079
|
+
dfpTargetingArguments: _propTypes.default.object,
|
|
12080
|
+
newSlotCallback: _propTypes.default.func
|
|
12081
|
+
};
|
|
12082
|
+
}
|
|
12083
|
+
});
|
|
12084
|
+
|
|
12085
|
+
unwrapExports(dfpslotsprovider);
|
|
12086
|
+
var dfpslotsprovider_1 = dfpslotsprovider.Context;
|
|
12087
|
+
|
|
12088
|
+
var adslot = createCommonjsModule(function (module, exports) {
|
|
12089
|
+
|
|
12090
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12091
|
+
value: true
|
|
12092
|
+
});
|
|
12093
|
+
exports.default = exports.AdSlot = void 0;
|
|
12094
|
+
|
|
12095
|
+
var _react = _interopRequireDefault(React__default);
|
|
12096
|
+
|
|
12097
|
+
var _propTypes = _interopRequireDefault(PropTypes);
|
|
12098
|
+
|
|
12099
|
+
var _manager = _interopRequireDefault(manager);
|
|
12100
|
+
|
|
12101
|
+
|
|
12102
|
+
|
|
12103
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12104
|
+
|
|
12105
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
12106
|
+
|
|
12107
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
12108
|
+
|
|
12109
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
|
12110
|
+
|
|
12111
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12112
|
+
|
|
12113
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
12114
|
+
|
|
12115
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
12116
|
+
|
|
12117
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
12118
|
+
|
|
12119
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
12120
|
+
|
|
12121
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
12122
|
+
|
|
12123
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12124
|
+
|
|
12125
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12126
|
+
|
|
12127
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12128
|
+
|
|
12129
|
+
var dynamicAdCount = 0;
|
|
12130
|
+
|
|
12131
|
+
var AdSlot =
|
|
12132
|
+
/*#__PURE__*/
|
|
12133
|
+
function (_React$Component) {
|
|
12134
|
+
_inherits(AdSlot, _React$Component);
|
|
12135
|
+
|
|
12136
|
+
function AdSlot(props) {
|
|
12137
|
+
var _this;
|
|
12138
|
+
|
|
12139
|
+
_classCallCheck(this, AdSlot);
|
|
12140
|
+
|
|
12141
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(AdSlot).call(this, props));
|
|
12142
|
+
_this.doRegisterSlot = _this.doRegisterSlot.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
12143
|
+
_this.generateSlotId = _this.generateSlotId.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
12144
|
+
_this.getSlotId = _this.getSlotId.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
12145
|
+
_this.mapContextToAdSlotProps = _this.mapContextToAdSlotProps.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
12146
|
+
_this.slotShouldRefresh = _this.slotShouldRefresh.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
12147
|
+
_this.slotRenderEnded = _this.slotRenderEnded.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
12148
|
+
_this.slotRegisterCallback = _this.slotRegisterCallback.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
12149
|
+
_this.slotIsViewable = _this.slotIsViewable.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
12150
|
+
_this.slotVisibilityChanged = _this.slotVisibilityChanged.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
12151
|
+
_this.getClasses = _this.getClasses.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
12152
|
+
_this.state = {
|
|
12153
|
+
slotId: _this.props.slotId || null,
|
|
12154
|
+
className: _this.props.className || ''
|
|
12155
|
+
};
|
|
12156
|
+
_this.adElementRef = _react.default.createRef ? _react.default.createRef() : function (element) {
|
|
12157
|
+
_this.adElementRef = element;
|
|
12158
|
+
};
|
|
12159
|
+
return _this;
|
|
12160
|
+
}
|
|
12161
|
+
|
|
12162
|
+
_createClass(AdSlot, [{
|
|
12163
|
+
key: "componentDidMount",
|
|
12164
|
+
value: function componentDidMount() {
|
|
12165
|
+
// register this ad-unit in the <DFPSlotProvider>, when available.
|
|
12166
|
+
if (this.context !== undefined && this.context.newSlotCallback) {
|
|
12167
|
+
this.context.newSlotCallback();
|
|
12168
|
+
}
|
|
12169
|
+
|
|
12170
|
+
this.registerSlot();
|
|
12171
|
+
}
|
|
12172
|
+
}, {
|
|
12173
|
+
key: "componentWillUnmount",
|
|
12174
|
+
value: function componentWillUnmount() {
|
|
12175
|
+
this.unregisterSlot();
|
|
12176
|
+
}
|
|
12177
|
+
}, {
|
|
12178
|
+
key: "getSlotId",
|
|
12179
|
+
value: function getSlotId() {
|
|
12180
|
+
return this.props.slotId || this.state.slotId;
|
|
12181
|
+
}
|
|
12182
|
+
}, {
|
|
12183
|
+
key: "getClasses",
|
|
12184
|
+
value: function getClasses() {
|
|
12185
|
+
var baseClass = 'adunitContainer';
|
|
12186
|
+
var extraClasses = this.state.className.split(' ');
|
|
12187
|
+
extraClasses.push(baseClass);
|
|
12188
|
+
return extraClasses;
|
|
12189
|
+
}
|
|
12190
|
+
}, {
|
|
12191
|
+
key: "generateSlotId",
|
|
12192
|
+
value: function generateSlotId() {
|
|
12193
|
+
return "adSlot-".concat(dynamicAdCount++);
|
|
12194
|
+
}
|
|
12195
|
+
}, {
|
|
12196
|
+
key: "mapContextToAdSlotProps",
|
|
12197
|
+
value: function mapContextToAdSlotProps() {
|
|
12198
|
+
var context = this.context;
|
|
12199
|
+
var mappedProps = {};
|
|
12200
|
+
|
|
12201
|
+
if (context.dfpNetworkId !== undefined) {
|
|
12202
|
+
mappedProps.dfpNetworkId = context.dfpNetworkId;
|
|
12203
|
+
}
|
|
12204
|
+
|
|
12205
|
+
if (context.dfpAdUnit !== undefined) {
|
|
12206
|
+
mappedProps.adUnit = context.dfpAdUnit;
|
|
12207
|
+
}
|
|
12208
|
+
|
|
12209
|
+
if (context.dfpSizeMapping !== undefined) {
|
|
12210
|
+
mappedProps.sizeMapping = context.dfpSizeMapping;
|
|
12211
|
+
}
|
|
12212
|
+
|
|
12213
|
+
if (context.dfpTargetingArguments !== undefined) {
|
|
12214
|
+
mappedProps.targetingArguments = context.dfpTargetingArguments;
|
|
12215
|
+
}
|
|
12216
|
+
|
|
12217
|
+
return mappedProps;
|
|
12218
|
+
}
|
|
12219
|
+
}, {
|
|
12220
|
+
key: "doRegisterSlot",
|
|
12221
|
+
value: function doRegisterSlot() {
|
|
12222
|
+
_manager.default.registerSlot(_objectSpread({}, this.mapContextToAdSlotProps(), this.props, this.state, {
|
|
12223
|
+
slotShouldRefresh: this.slotShouldRefresh
|
|
12224
|
+
}));
|
|
12225
|
+
|
|
12226
|
+
if (this.props.fetchNow === true) {
|
|
12227
|
+
_manager.default.load(this.getSlotId());
|
|
12228
|
+
}
|
|
12229
|
+
|
|
12230
|
+
_manager.default.attachSlotRenderEnded(this.slotRenderEnded);
|
|
12231
|
+
|
|
12232
|
+
_manager.default.attachSlotIsViewable(this.slotIsViewable);
|
|
12233
|
+
|
|
12234
|
+
_manager.default.attachSlotVisibilityChanged(this.slotVisibilityChanged);
|
|
12235
|
+
|
|
12236
|
+
this.slotRegisterCallback();
|
|
12237
|
+
}
|
|
12238
|
+
}, {
|
|
12239
|
+
key: "registerSlot",
|
|
12240
|
+
value: function registerSlot() {
|
|
12241
|
+
if (this.state.slotId === null) {
|
|
12242
|
+
this.setState({
|
|
12243
|
+
slotId: this.generateSlotId()
|
|
12244
|
+
}, this.doRegisterSlot);
|
|
12245
|
+
} else {
|
|
12246
|
+
this.doRegisterSlot();
|
|
12247
|
+
}
|
|
12248
|
+
}
|
|
12249
|
+
}, {
|
|
12250
|
+
key: "unregisterSlot",
|
|
12251
|
+
value: function unregisterSlot() {
|
|
12252
|
+
_manager.default.unregisterSlot(_objectSpread({}, this.mapContextToAdSlotProps(), this.props, this.state));
|
|
12253
|
+
|
|
12254
|
+
_manager.default.detachSlotRenderEnded(this.slotRenderEnded);
|
|
12255
|
+
|
|
12256
|
+
_manager.default.detachSlotIsViewable(this.slotIsViewable);
|
|
12257
|
+
|
|
12258
|
+
_manager.default.detachSlotVisibilityChanged(this.slotVisibilityChanged);
|
|
12259
|
+
}
|
|
12260
|
+
}, {
|
|
12261
|
+
key: "slotRenderEnded",
|
|
12262
|
+
value: function slotRenderEnded(eventData) {
|
|
12263
|
+
if (eventData.slotId === this.getSlotId()) {
|
|
12264
|
+
if (this.props.onSlotRender !== undefined) {
|
|
12265
|
+
// now that slot has rendered we have access to the ref
|
|
12266
|
+
var params = _objectSpread({}, eventData, {
|
|
12267
|
+
adElementRef: this.adElementRef
|
|
12268
|
+
});
|
|
12269
|
+
|
|
12270
|
+
this.props.onSlotRender(params);
|
|
12271
|
+
}
|
|
12272
|
+
}
|
|
12273
|
+
}
|
|
12274
|
+
}, {
|
|
12275
|
+
key: "slotRegisterCallback",
|
|
12276
|
+
value: function slotRegisterCallback() {
|
|
12277
|
+
if (typeof this.props.onSlotRegister === 'function') {
|
|
12278
|
+
this.props.onSlotRegister({
|
|
12279
|
+
slotId: this.getSlotId(),
|
|
12280
|
+
sizes: this.props.sizes,
|
|
12281
|
+
slotCount: dynamicAdCount,
|
|
12282
|
+
adElementRef: this.adElementRef
|
|
12283
|
+
});
|
|
12284
|
+
}
|
|
12285
|
+
}
|
|
12286
|
+
}, {
|
|
12287
|
+
key: "slotIsViewable",
|
|
12288
|
+
value: function slotIsViewable(eventData) {
|
|
12289
|
+
if (eventData.slotId === this.getSlotId()) {
|
|
12290
|
+
if (this.props.onSlotIsViewable !== undefined) {
|
|
12291
|
+
this.props.onSlotIsViewable(eventData);
|
|
12292
|
+
}
|
|
12293
|
+
}
|
|
12294
|
+
}
|
|
12295
|
+
}, {
|
|
12296
|
+
key: "slotVisibilityChanged",
|
|
12297
|
+
value: function slotVisibilityChanged(eventData) {
|
|
12298
|
+
if (eventData.slotId === this.getSlotId()) {
|
|
12299
|
+
if (this.props.onSlotVisibilityChanged !== undefined) {
|
|
12300
|
+
this.props.onSlotVisibilityChanged(eventData);
|
|
12301
|
+
}
|
|
12302
|
+
}
|
|
12303
|
+
}
|
|
12304
|
+
}, {
|
|
12305
|
+
key: "slotShouldRefresh",
|
|
12306
|
+
value: function slotShouldRefresh() {
|
|
12307
|
+
var r = true;
|
|
12308
|
+
|
|
12309
|
+
if (this.props.shouldRefresh !== undefined) {
|
|
12310
|
+
r = this.props.shouldRefresh(_objectSpread({}, this.mapContextToAdSlotProps(), this.props, {
|
|
12311
|
+
slotId: this.getSlotId()
|
|
12312
|
+
}));
|
|
12313
|
+
}
|
|
12314
|
+
|
|
12315
|
+
return r;
|
|
12316
|
+
}
|
|
12317
|
+
}, {
|
|
12318
|
+
key: "render",
|
|
12319
|
+
value: function render() {
|
|
12320
|
+
var slotId = this.state.slotId;
|
|
12321
|
+
var props = {
|
|
12322
|
+
className: 'adBox'
|
|
12323
|
+
};
|
|
12324
|
+
|
|
12325
|
+
if (slotId !== null) {
|
|
12326
|
+
props.id = slotId;
|
|
12327
|
+
}
|
|
12328
|
+
|
|
12329
|
+
return _react.default.createElement("div", {
|
|
12330
|
+
className: this.getClasses().join(' ').trim()
|
|
12331
|
+
}, _react.default.createElement("div", _extends({
|
|
12332
|
+
ref: this.adElementRef
|
|
12333
|
+
}, props)));
|
|
12334
|
+
}
|
|
12335
|
+
}]);
|
|
12336
|
+
|
|
12337
|
+
return AdSlot;
|
|
12338
|
+
}(_react.default.Component);
|
|
12339
|
+
|
|
12340
|
+
exports.AdSlot = AdSlot;
|
|
12341
|
+
|
|
12342
|
+
_defineProperty(AdSlot, "propTypes", {
|
|
12343
|
+
dfpNetworkId: _propTypes.default.string,
|
|
12344
|
+
adUnit: _propTypes.default.string,
|
|
12345
|
+
sizes: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.number), _propTypes.default.string])),
|
|
12346
|
+
renderOutOfThePage: _propTypes.default.bool,
|
|
12347
|
+
sizeMapping: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
12348
|
+
fetchNow: _propTypes.default.bool,
|
|
12349
|
+
adSenseAttributes: _propTypes.default.object,
|
|
12350
|
+
targetingArguments: _propTypes.default.object,
|
|
12351
|
+
onSlotRender: _propTypes.default.func,
|
|
12352
|
+
onSlotRegister: _propTypes.default.func,
|
|
12353
|
+
onSlotIsViewable: _propTypes.default.func,
|
|
12354
|
+
onSlotVisibilityChanged: _propTypes.default.func,
|
|
12355
|
+
shouldRefresh: _propTypes.default.func,
|
|
12356
|
+
slotId: _propTypes.default.string,
|
|
12357
|
+
className: _propTypes.default.string
|
|
12358
|
+
});
|
|
12359
|
+
|
|
12360
|
+
_defineProperty(AdSlot, "defaultProps", {
|
|
12361
|
+
fetchNow: false
|
|
12362
|
+
});
|
|
12363
|
+
|
|
12364
|
+
if (dfpslotsprovider.Context === null) {
|
|
12365
|
+
// React < 16.3
|
|
12366
|
+
AdSlot.contextTypes = {
|
|
12367
|
+
dfpNetworkId: _propTypes.default.string,
|
|
12368
|
+
dfpAdUnit: _propTypes.default.string,
|
|
12369
|
+
dfpSizeMapping: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
12370
|
+
dfpTargetingArguments: _propTypes.default.object,
|
|
12371
|
+
newSlotCallback: _propTypes.default.func
|
|
12372
|
+
};
|
|
12373
|
+
} else {
|
|
12374
|
+
AdSlot.contextType = dfpslotsprovider.Context;
|
|
12375
|
+
}
|
|
12376
|
+
|
|
12377
|
+
var _default = AdSlot;
|
|
12378
|
+
exports.default = _default;
|
|
12379
|
+
});
|
|
12380
|
+
|
|
12381
|
+
unwrapExports(adslot);
|
|
12382
|
+
var adslot_1 = adslot.AdSlot;
|
|
12383
|
+
|
|
12384
|
+
var lib = createCommonjsModule(function (module, exports) {
|
|
12385
|
+
|
|
12386
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12387
|
+
value: true
|
|
12388
|
+
});
|
|
12389
|
+
exports.DFPSlotsProvider = exports.AdSlot = exports.DFPManager = void 0;
|
|
12390
|
+
|
|
12391
|
+
var _manager = _interopRequireDefault(manager);
|
|
12392
|
+
|
|
12393
|
+
var _adslot = _interopRequireDefault(adslot);
|
|
12394
|
+
|
|
12395
|
+
var _dfpslotsprovider = _interopRequireDefault(dfpslotsprovider);
|
|
12396
|
+
|
|
12397
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12398
|
+
|
|
12399
|
+
var DFPManager = _manager.default;
|
|
12400
|
+
exports.DFPManager = DFPManager;
|
|
12401
|
+
var AdSlot = _adslot.default;
|
|
12402
|
+
exports.AdSlot = AdSlot;
|
|
12403
|
+
var DFPSlotsProvider = _dfpslotsprovider.default;
|
|
12404
|
+
exports.DFPSlotsProvider = DFPSlotsProvider;
|
|
12405
|
+
});
|
|
12406
|
+
|
|
12407
|
+
unwrapExports(lib);
|
|
12408
|
+
var lib_1 = lib.DFPSlotsProvider;
|
|
12409
|
+
var lib_2 = lib.AdSlot;
|
|
12410
|
+
var lib_3 = lib.DFPManager;
|
|
12411
|
+
|
|
12412
|
+
var AD728x90 = function (_Component) {
|
|
12413
|
+
inherits(AD728x90, _Component);
|
|
12414
|
+
|
|
12415
|
+
function AD728x90(props) {
|
|
12416
|
+
classCallCheck(this, AD728x90);
|
|
12417
|
+
|
|
12418
|
+
var _this = possibleConstructorReturn(this, (AD728x90.__proto__ || Object.getPrototypeOf(AD728x90)).call(this, props));
|
|
12419
|
+
|
|
12420
|
+
_this.option = {
|
|
12421
|
+
networkID: props.networkID,
|
|
12422
|
+
adUnit: props.adUnit
|
|
12423
|
+
};
|
|
12424
|
+
return _this;
|
|
12425
|
+
}
|
|
12426
|
+
|
|
12427
|
+
createClass(AD728x90, [{
|
|
12428
|
+
key: 'render',
|
|
12429
|
+
value: function render() {
|
|
12430
|
+
return React__default.createElement(
|
|
12431
|
+
lib_1,
|
|
12432
|
+
{
|
|
12433
|
+
dfpNetworkId: this.option.networkID,
|
|
12434
|
+
sizeMapping: [{ viewport: [768, 1], sizes: [[728, 90]] }, { viewport: [1, 1], sizes: [[320, 50]] }] },
|
|
12435
|
+
React__default.createElement(
|
|
12436
|
+
'div',
|
|
12437
|
+
{ className: 'AD728x90' },
|
|
12438
|
+
React__default.createElement(lib_2, {
|
|
12439
|
+
slotId: 'test',
|
|
12440
|
+
sizes: [[728, 90], [320, 50]],
|
|
12441
|
+
adUnit: this.option.adUnit,
|
|
12442
|
+
sizeMapping: [{ viewport: [768, 1], sizes: [[728, 90]] }, { viewport: [1, 1], sizes: [[320, 50]] }],
|
|
12443
|
+
onSlotVisibilityChanged: function onSlotVisibilityChanged(dfpEventData) {
|
|
12444
|
+
if (dfpEventData.event.inViewPercentage < '70') {
|
|
12445
|
+
lib_3.refresh('test');
|
|
12446
|
+
}
|
|
12447
|
+
},
|
|
12448
|
+
onSlotIsViewable: function onSlotIsViewable(dfpEventData) {
|
|
12449
|
+
return console.log('slot 1 viewable!.', dfpEventData);
|
|
12450
|
+
}
|
|
12451
|
+
})
|
|
12452
|
+
)
|
|
12453
|
+
);
|
|
12454
|
+
}
|
|
12455
|
+
}]);
|
|
12456
|
+
return AD728x90;
|
|
12457
|
+
}(Component);
|
|
12458
|
+
|
|
12459
|
+
// Main
|
|
12460
|
+
var Normal$1 = function Normal$$1(props) {
|
|
12461
|
+
var config = props.config,
|
|
12462
|
+
title = props.title,
|
|
12463
|
+
keywords = props.keywords,
|
|
12464
|
+
description = props.description,
|
|
12465
|
+
website = props.website;
|
|
12466
|
+
|
|
12467
|
+
|
|
12468
|
+
function navigation() {
|
|
12469
|
+
switch (config.navComponent) {
|
|
12470
|
+
case 'normal':
|
|
12471
|
+
return React__default.createElement(Normal, { logo: website.logo, dataObject: config.navItems });
|
|
12472
|
+
case 'magazine':
|
|
12473
|
+
return React__default.createElement(Magazine, { logo: website.logo, dataObject: config.navItems });
|
|
12474
|
+
case 'native':
|
|
12475
|
+
return React__default.createElement(Native, { logo: website.logo, dataObject: config.navItems });
|
|
12476
|
+
default:
|
|
12477
|
+
return React__default.createElement('noNav', null);
|
|
12478
|
+
}
|
|
12479
|
+
}
|
|
12480
|
+
|
|
12481
|
+
function layout() {
|
|
12482
|
+
switch (config.columns) {
|
|
12483
|
+
case '2':
|
|
12484
|
+
return React__default.createElement(
|
|
12485
|
+
Column2,
|
|
12486
|
+
{ rightItems: config.rightItems },
|
|
12487
|
+
props.children
|
|
12488
|
+
);
|
|
12489
|
+
case '3':
|
|
12490
|
+
return React__default.createElement(
|
|
12491
|
+
Column3,
|
|
12492
|
+
{ leftItems: config.leftItems, rightItems: config.rightItems },
|
|
12493
|
+
props.children
|
|
12494
|
+
);
|
|
12495
|
+
default:
|
|
12496
|
+
return React__default.createElement('noLayout', null);
|
|
12497
|
+
}
|
|
12498
|
+
}
|
|
12499
|
+
|
|
12500
|
+
return React__default.createElement(
|
|
12501
|
+
'section',
|
|
12502
|
+
null,
|
|
12503
|
+
React__default.createElement(Header, { title: title, keyword: keywords, description: description }),
|
|
12504
|
+
navigation(),
|
|
12505
|
+
React__default.createElement(
|
|
12506
|
+
Container,
|
|
12507
|
+
null,
|
|
12508
|
+
React__default.createElement(AD728x90, { networkID: '20642765', adUnit: 'aesthetic_authority' })
|
|
12509
|
+
),
|
|
12510
|
+
React__default.createElement(
|
|
12511
|
+
Container,
|
|
12512
|
+
null,
|
|
12513
|
+
layout()
|
|
12514
|
+
)
|
|
12515
|
+
);
|
|
12516
|
+
};
|
|
12517
|
+
|
|
12518
|
+
export { Content as DeckContent, Queue as DeckQueue, Column2, Column3, Header, LeftNav, Magazine as NavMagazine, Native as NavNative, Normal as NavNormal, Normal$1 as TemplateNormal };
|
|
11235
12519
|
//# sourceMappingURL=index.es.js.map
|