@folklore/ads 0.0.39 → 0.0.40
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/cjs.js +20 -7
- package/dist/es.js +20 -7
- package/package.json +2 -2
package/dist/cjs.js
CHANGED
|
@@ -276,12 +276,16 @@ class AdSlot extends EventEmitter__default["default"] {
|
|
|
276
276
|
/* globals refreshDisabledLineItems: [] */
|
|
277
277
|
const debug = createDebug__default["default"]('folklore:ads');
|
|
278
278
|
class AdsManager extends EventEmitter__default["default"] {
|
|
279
|
-
static index = 0;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}
|
|
279
|
+
// static index = 0;
|
|
280
|
+
|
|
281
|
+
// static createAdId() {
|
|
282
|
+
// const newId = `div-gpt-ad-${new Date().getTime()}-${Math.round(
|
|
283
|
+
// Math.random() * (Math.random() * 1000),
|
|
284
|
+
// )}-${AdsManager.index}`;
|
|
285
|
+
// AdsManager.index += 1;
|
|
286
|
+
// return newId;
|
|
287
|
+
// }
|
|
288
|
+
|
|
285
289
|
static getArticleTargeting(article) {
|
|
286
290
|
if (article === null) {
|
|
287
291
|
return null;
|
|
@@ -346,10 +350,19 @@ class AdsManager extends EventEmitter__default["default"] {
|
|
|
346
350
|
cmd: []
|
|
347
351
|
};
|
|
348
352
|
this.slots = [];
|
|
353
|
+
this.index = 0;
|
|
349
354
|
if (this.options.autoInit) {
|
|
350
355
|
this.init();
|
|
351
356
|
}
|
|
352
357
|
}
|
|
358
|
+
createAdId() {
|
|
359
|
+
// const newId = `div-gpt-ad-${new Date().getTime()}-${Math.round(
|
|
360
|
+
// Math.random() * (Math.random() * 1000),
|
|
361
|
+
// )}-${this.index}`;
|
|
362
|
+
const newId = `div-gpt-ad-${this.index}`;
|
|
363
|
+
this.index += 1;
|
|
364
|
+
return newId;
|
|
365
|
+
}
|
|
353
366
|
onGPTReady() {
|
|
354
367
|
const {
|
|
355
368
|
googletag
|
|
@@ -478,7 +491,7 @@ class AdsManager extends EventEmitter__default["default"] {
|
|
|
478
491
|
const {
|
|
479
492
|
id: providedId = null
|
|
480
493
|
} = opts;
|
|
481
|
-
const id = providedId ||
|
|
494
|
+
const id = providedId || this.createAdId();
|
|
482
495
|
debug('Creating slot #%s(%s)...', id, path);
|
|
483
496
|
const slot = new AdSlot(id, path, size, {
|
|
484
497
|
...opts
|
package/dist/es.js
CHANGED
|
@@ -258,12 +258,16 @@ class AdSlot extends EventEmitter {
|
|
|
258
258
|
/* globals refreshDisabledLineItems: [] */
|
|
259
259
|
const debug = createDebug('folklore:ads');
|
|
260
260
|
class AdsManager extends EventEmitter {
|
|
261
|
-
static index = 0;
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
261
|
+
// static index = 0;
|
|
262
|
+
|
|
263
|
+
// static createAdId() {
|
|
264
|
+
// const newId = `div-gpt-ad-${new Date().getTime()}-${Math.round(
|
|
265
|
+
// Math.random() * (Math.random() * 1000),
|
|
266
|
+
// )}-${AdsManager.index}`;
|
|
267
|
+
// AdsManager.index += 1;
|
|
268
|
+
// return newId;
|
|
269
|
+
// }
|
|
270
|
+
|
|
267
271
|
static getArticleTargeting(article) {
|
|
268
272
|
if (article === null) {
|
|
269
273
|
return null;
|
|
@@ -328,10 +332,19 @@ class AdsManager extends EventEmitter {
|
|
|
328
332
|
cmd: []
|
|
329
333
|
};
|
|
330
334
|
this.slots = [];
|
|
335
|
+
this.index = 0;
|
|
331
336
|
if (this.options.autoInit) {
|
|
332
337
|
this.init();
|
|
333
338
|
}
|
|
334
339
|
}
|
|
340
|
+
createAdId() {
|
|
341
|
+
// const newId = `div-gpt-ad-${new Date().getTime()}-${Math.round(
|
|
342
|
+
// Math.random() * (Math.random() * 1000),
|
|
343
|
+
// )}-${this.index}`;
|
|
344
|
+
const newId = `div-gpt-ad-${this.index}`;
|
|
345
|
+
this.index += 1;
|
|
346
|
+
return newId;
|
|
347
|
+
}
|
|
335
348
|
onGPTReady() {
|
|
336
349
|
const {
|
|
337
350
|
googletag
|
|
@@ -460,7 +473,7 @@ class AdsManager extends EventEmitter {
|
|
|
460
473
|
const {
|
|
461
474
|
id: providedId = null
|
|
462
475
|
} = opts;
|
|
463
|
-
const id = providedId ||
|
|
476
|
+
const id = providedId || this.createAdId();
|
|
464
477
|
debug('Creating slot #%s(%s)...', id, path);
|
|
465
478
|
const slot = new AdSlot(id, path, size, {
|
|
466
479
|
...opts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@folklore/ads",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"description": "Ads library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "9b792452940372423d526d0fb10d3f427b7ebe1c",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@folklore/hooks": "^0.0.44",
|
|
56
56
|
"@folklore/tracking": "^0.0.23",
|