@mjhls/mjh-framework 1.0.707-beta.0 → 1.0.707-beta.1

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.
Files changed (77) hide show
  1. package/dist/cjs/AD.js +1 -1
  2. package/dist/cjs/AD300x250.js +1 -1
  3. package/dist/cjs/AD300x250x600.js +1 -1
  4. package/dist/cjs/AD728x90.js +1 -1
  5. package/dist/cjs/ADFloatingFooter.js +1 -1
  6. package/dist/cjs/ADGutter.js +1 -1
  7. package/dist/cjs/ADSkyscraper.js +1 -1
  8. package/dist/cjs/ADSponsoredResources.js +1 -1
  9. package/dist/cjs/ADWebcast.js +1 -1
  10. package/dist/cjs/ADWelcome.js +1 -1
  11. package/dist/cjs/AdSlot.js +1 -1
  12. package/dist/cjs/AdSlotsProvider.js +2 -6
  13. package/dist/cjs/ArticleSeriesListing.js +1 -1
  14. package/dist/cjs/Auth.js +206 -6
  15. package/dist/cjs/CMEDeck.js +1 -1
  16. package/dist/cjs/Column3.js +1 -1
  17. package/dist/cjs/DeckContent.js +2 -2
  18. package/dist/cjs/DeckQueue.js +1 -1
  19. package/dist/cjs/{Dfp-f6a18ed2.js → Dfp-ce7ac168.js} +1 -1
  20. package/dist/cjs/ExternalResources.js +2 -2
  21. package/dist/cjs/GridContent.js +3 -3
  22. package/dist/cjs/IssueLanding.js +3 -3
  23. package/dist/cjs/LeftNav.js +1 -1
  24. package/dist/cjs/MasterDeck.js +3 -3
  25. package/dist/cjs/PartnerDetailListing.js +4 -4
  26. package/dist/cjs/QueueDeckExpanded.js +5 -9
  27. package/dist/cjs/TaxonomyDescription.js +2 -2
  28. package/dist/cjs/TemplateNormal.js +1 -1
  29. package/dist/cjs/VideoSeriesListing.js +1 -1
  30. package/dist/cjs/View.js +4 -4
  31. package/dist/cjs/getRelatedArticle.js +5 -354
  32. package/dist/cjs/getSerializers.js +2 -2
  33. package/dist/cjs/{index-e1275933.js → index-427156b6.js} +1 -1
  34. package/dist/cjs/{index-fa8ed292.js → index-8bf6c863.js} +63 -37
  35. package/dist/cjs/index.js +7 -7
  36. package/dist/esm/AD.js +1 -1
  37. package/dist/esm/AD300x250.js +1 -1
  38. package/dist/esm/AD300x250x600.js +1 -1
  39. package/dist/esm/AD728x90.js +1 -1
  40. package/dist/esm/ADFloatingFooter.js +1 -1
  41. package/dist/esm/ADGutter.js +1 -1
  42. package/dist/esm/ADSkyscraper.js +1 -1
  43. package/dist/esm/ADSponsoredResources.js +1 -1
  44. package/dist/esm/ADWebcast.js +1 -1
  45. package/dist/esm/ADWelcome.js +1 -1
  46. package/dist/esm/AdSlot.js +1 -1
  47. package/dist/esm/AdSlotsProvider.js +2 -6
  48. package/dist/esm/ArticleSeriesListing.js +1 -1
  49. package/dist/esm/Auth.js +201 -1
  50. package/dist/esm/CMEDeck.js +1 -1
  51. package/dist/esm/Column3.js +1 -1
  52. package/dist/esm/DeckContent.js +2 -2
  53. package/dist/esm/DeckQueue.js +1 -1
  54. package/dist/esm/{Dfp-96b49def.js → Dfp-14e866d7.js} +1 -1
  55. package/dist/esm/ExternalResources.js +2 -2
  56. package/dist/esm/GridContent.js +3 -3
  57. package/dist/esm/IssueLanding.js +3 -3
  58. package/dist/esm/LeftNav.js +1 -1
  59. package/dist/esm/MasterDeck.js +3 -3
  60. package/dist/esm/PartnerDetailListing.js +4 -4
  61. package/dist/esm/QueueDeckExpanded.js +5 -9
  62. package/dist/esm/TaxonomyDescription.js +2 -2
  63. package/dist/esm/TemplateNormal.js +1 -1
  64. package/dist/esm/VideoSeriesListing.js +1 -1
  65. package/dist/esm/View.js +4 -4
  66. package/dist/esm/getRelatedArticle.js +5 -354
  67. package/dist/esm/getSerializers.js +2 -2
  68. package/dist/esm/{index-b2fb5cf2.js → index-20de5762.js} +1 -1
  69. package/dist/esm/{index-0e45a0b2.js → index-a9e53f80.js} +63 -37
  70. package/dist/esm/index.js +6 -6
  71. package/package.json +2 -2
  72. package/dist/cjs/index-bd6c9f56.js +0 -211
  73. package/dist/esm/index-db3bb315.js +0 -207
  74. /package/dist/cjs/{ADInfeed-2d466478.js → ADInfeed-30227d30.js} +0 -0
  75. /package/dist/cjs/{ADlgInfeed-a437d8a6.js → ADlgInfeed-8432091c.js} +0 -0
  76. /package/dist/esm/{ADInfeed-bdd220fa.js → ADInfeed-afa3ab79.js} +0 -0
  77. /package/dist/esm/{ADlgInfeed-e6762952.js → ADlgInfeed-20c39d33.js} +0 -0
@@ -12,7 +12,7 @@ import './web.dom.iterable-8956f9a5.js';
12
12
  import './typeof-08f2c380.js';
13
13
  import './_is-array-49698029.js';
14
14
  import React__default from 'react';
15
- import { l as lib_3 } from './index-0e45a0b2.js';
15
+ import { l as lib_3 } from './index-a9e53f80.js';
16
16
  import 'prop-types';
17
17
  import Container from 'react-bootstrap/Container';
18
18
  import { m as moment } from './moment-e2f9b20c.js';
package/dist/esm/View.js CHANGED
@@ -14,7 +14,7 @@ import './web.dom.iterable-8956f9a5.js';
14
14
  import { _ as _typeof } from './typeof-08f2c380.js';
15
15
  import './_is-array-49698029.js';
16
16
  import React__default, { useState, useRef, useEffect } from 'react';
17
- import { l as lib_3 } from './index-0e45a0b2.js';
17
+ import { l as lib_3 } from './index-a9e53f80.js';
18
18
  import 'prop-types';
19
19
  import 'react-bootstrap/Row';
20
20
  import 'react-bootstrap/Col';
@@ -43,7 +43,7 @@ import './iconBase-602d52fe.js';
43
43
  import './index.esm-29e48d38.js';
44
44
  import Button from 'react-bootstrap/Button';
45
45
  import Form from 'react-bootstrap/Form';
46
- import { I as InscreenSensor, r as renderAuthor, g as getSerializers } from './index-b2fb5cf2.js';
46
+ import { I as InscreenSensor, r as renderAuthor, g as getSerializers } from './index-20de5762.js';
47
47
  import './util-7700fc59.js';
48
48
  import './brightcove-react-player-loader.es-83f53e4e.js';
49
49
  import 'react-bootstrap/Pagination';
@@ -56,9 +56,9 @@ import { _ as _Object$keys } from './keys-fc2d4c34.js';
56
56
  import 'react-bootstrap/Dropdown';
57
57
  import { b as FaMinus, c as FaPlus } from './index.esm-cf08bf18.js';
58
58
  import getSeriesDetail from './getSeriesDetail.js';
59
- import './index-db3bb315.js';
60
- import getRelatedArticle from './getRelatedArticle.js';
59
+ import 'nookies';
61
60
  import getQuery from './getQuery.js';
61
+ import getRelatedArticle from './getRelatedArticle.js';
62
62
  import { g as getTargeting, a as getContentPlacementUrl } from './getTargeting-2acdec91.js';
63
63
  import getKeywords from './getKeywords.js';
64
64
  import urlFor from './urlFor.js';
@@ -1,4 +1,4 @@
1
- import { c as createCommonjsModule, u as unwrapExports, a as commonjsGlobal } from './_commonjsHelpers-0c4b6f40.js';
1
+ import './_commonjsHelpers-0c4b6f40.js';
2
2
  import './_to-object-ded78eb9.js';
3
3
  import './es6.string.iterator-9b2af4a5.js';
4
4
  import './_library-528f1934.js';
@@ -7,358 +7,9 @@ import './core.get-iterator-method-54d2e411.js';
7
7
  import './web.dom.iterable-8956f9a5.js';
8
8
  import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-7c654f36.js';
9
9
  import './_set-species-cede29f8.js';
10
- import { c as cookie } from './index-db3bb315.js';
10
+ import { parseCookies, setCookie } from 'nookies';
11
11
  import getQuery from './getQuery.js';
12
12
 
13
- var defaultParseOptions = {
14
- decodeValues: true,
15
- map: false,
16
- silent: false,
17
- };
18
-
19
- function isNonEmptyString(str) {
20
- return typeof str === "string" && !!str.trim();
21
- }
22
-
23
- function parseString(setCookieValue, options) {
24
- var parts = setCookieValue.split(";").filter(isNonEmptyString);
25
- var nameValue = parts.shift().split("=");
26
- var name = nameValue.shift();
27
- var value = nameValue.join("="); // everything after the first =, joined by a "=" if there was more than one part
28
-
29
- options = options
30
- ? Object.assign({}, defaultParseOptions, options)
31
- : defaultParseOptions;
32
-
33
- var cookie = {
34
- name: name, // grab everything before the first =
35
- value: options.decodeValues ? decodeURIComponent(value) : value, // decode cookie value
36
- };
37
-
38
- parts.forEach(function (part) {
39
- var sides = part.split("=");
40
- var key = sides.shift().trimLeft().toLowerCase();
41
- var value = sides.join("=");
42
- if (key === "expires") {
43
- cookie.expires = new Date(value);
44
- } else if (key === "max-age") {
45
- cookie.maxAge = parseInt(value, 10);
46
- } else if (key === "secure") {
47
- cookie.secure = true;
48
- } else if (key === "httponly") {
49
- cookie.httpOnly = true;
50
- } else if (key === "samesite") {
51
- cookie.sameSite = value;
52
- } else {
53
- cookie[key] = value;
54
- }
55
- });
56
-
57
- return cookie;
58
- }
59
-
60
- function parse(input, options) {
61
- options = options
62
- ? Object.assign({}, defaultParseOptions, options)
63
- : defaultParseOptions;
64
-
65
- if (!input) {
66
- if (!options.map) {
67
- return [];
68
- } else {
69
- return {};
70
- }
71
- }
72
-
73
- if (input.headers && input.headers["set-cookie"]) {
74
- // fast-path for node.js (which automatically normalizes header names to lower-case
75
- input = input.headers["set-cookie"];
76
- } else if (input.headers) {
77
- // slow-path for other environments - see #25
78
- var sch =
79
- input.headers[
80
- Object.keys(input.headers).find(function (key) {
81
- return key.toLowerCase() === "set-cookie";
82
- })
83
- ];
84
- // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
85
- if (!sch && input.headers.cookie && !options.silent) {
86
- console.warn(
87
- "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
88
- );
89
- }
90
- input = sch;
91
- }
92
- if (!Array.isArray(input)) {
93
- input = [input];
94
- }
95
-
96
- options = options
97
- ? Object.assign({}, defaultParseOptions, options)
98
- : defaultParseOptions;
99
-
100
- if (!options.map) {
101
- return input.filter(isNonEmptyString).map(function (str) {
102
- return parseString(str, options);
103
- });
104
- } else {
105
- var cookies = {};
106
- return input.filter(isNonEmptyString).reduce(function (cookies, str) {
107
- var cookie = parseString(str, options);
108
- cookies[cookie.name] = cookie;
109
- return cookies;
110
- }, cookies);
111
- }
112
- }
113
-
114
- /*
115
- Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
116
- that are within a single set-cookie field-value, such as in the Expires portion.
117
-
118
- This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
119
- Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
120
- React Native's fetch does this for *every* header, including set-cookie.
121
-
122
- Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
123
- Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
124
- */
125
- function splitCookiesString(cookiesString) {
126
- if (Array.isArray(cookiesString)) {
127
- return cookiesString;
128
- }
129
- if (typeof cookiesString !== "string") {
130
- return [];
131
- }
132
-
133
- var cookiesStrings = [];
134
- var pos = 0;
135
- var start;
136
- var ch;
137
- var lastComma;
138
- var nextStart;
139
- var cookiesSeparatorFound;
140
-
141
- function skipWhitespace() {
142
- while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
143
- pos += 1;
144
- }
145
- return pos < cookiesString.length;
146
- }
147
-
148
- function notSpecialChar() {
149
- ch = cookiesString.charAt(pos);
150
-
151
- return ch !== "=" && ch !== ";" && ch !== ",";
152
- }
153
-
154
- while (pos < cookiesString.length) {
155
- start = pos;
156
- cookiesSeparatorFound = false;
157
-
158
- while (skipWhitespace()) {
159
- ch = cookiesString.charAt(pos);
160
- if (ch === ",") {
161
- // ',' is a cookie separator if we have later first '=', not ';' or ','
162
- lastComma = pos;
163
- pos += 1;
164
-
165
- skipWhitespace();
166
- nextStart = pos;
167
-
168
- while (pos < cookiesString.length && notSpecialChar()) {
169
- pos += 1;
170
- }
171
-
172
- // currently special character
173
- if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
174
- // we found cookies separator
175
- cookiesSeparatorFound = true;
176
- // pos is inside the next cookie, so back up and return it.
177
- pos = nextStart;
178
- cookiesStrings.push(cookiesString.substring(start, lastComma));
179
- start = pos;
180
- } else {
181
- // in param ',' or param separator ';',
182
- // we continue from that comma
183
- pos = lastComma + 1;
184
- }
185
- } else {
186
- pos += 1;
187
- }
188
- }
189
-
190
- if (!cookiesSeparatorFound || pos >= cookiesString.length) {
191
- cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
192
- }
193
- }
194
-
195
- return cookiesStrings;
196
- }
197
-
198
- var setCookie = parse;
199
- var parse_1 = parse;
200
- var parseString_1 = parseString;
201
- var splitCookiesString_1 = splitCookiesString;
202
- setCookie.parse = parse_1;
203
- setCookie.parseString = parseString_1;
204
- setCookie.splitCookiesString = splitCookiesString_1;
205
-
206
- var dist = createCommonjsModule(function (module, exports) {
207
- var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
208
- __assign = Object.assign || function(t) {
209
- for (var s, i = 1, n = arguments.length; i < n; i++) {
210
- s = arguments[i];
211
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
212
- t[p] = s[p];
213
- }
214
- return t;
215
- };
216
- return __assign.apply(this, arguments);
217
- };
218
- Object.defineProperty(exports, "__esModule", { value: true });
219
- exports.destroyCookie = exports.setCookie = exports.parseCookies = void 0;
220
-
221
-
222
- var isBrowser = function () { return typeof window !== 'undefined'; };
223
- function hasSameProperties(a, b) {
224
- var aProps = Object.getOwnPropertyNames(a);
225
- var bProps = Object.getOwnPropertyNames(b);
226
- if (aProps.length !== bProps.length) {
227
- return false;
228
- }
229
- for (var i = 0; i < aProps.length; i++) {
230
- var propName = aProps[i];
231
- if (a[propName] !== b[propName]) {
232
- return false;
233
- }
234
- }
235
- return true;
236
- }
237
- /**
238
- * Compare the cookie and return true if the cookies has equivalent
239
- * options and the cookies would be overwritten in the browser storage.
240
- *
241
- * @param a first Cookie for comparison
242
- * @param b second Cookie for comparison
243
- */
244
- function areCookiesEqual(a, b) {
245
- var sameSiteSame = a.sameSite === b.sameSite;
246
- if (typeof a.sameSite === 'string' && typeof b.sameSite === 'string') {
247
- sameSiteSame = a.sameSite.toLowerCase() === b.sameSite.toLowerCase();
248
- }
249
- return (hasSameProperties(__assign(__assign({}, a), { sameSite: undefined }), __assign(__assign({}, b), { sameSite: undefined })) && sameSiteSame);
250
- }
251
- /**
252
- * Create an instance of the Cookie interface
253
- *
254
- * @param name name of the Cookie
255
- * @param value value of the Cookie
256
- * @param options Cookie options
257
- */
258
- function createCookie(name, value, options) {
259
- var sameSite = options.sameSite;
260
- if (sameSite === true) {
261
- sameSite = 'strict';
262
- }
263
- if (sameSite === undefined || sameSite === false) {
264
- sameSite = 'lax';
265
- }
266
- var cookieToSet = __assign(__assign({}, options), { sameSite: sameSite });
267
- delete cookieToSet.encode;
268
- return __assign({ name: name, value: value }, cookieToSet);
269
- }
270
- /**
271
- *
272
- * Parses cookies.
273
- *
274
- * @param ctx
275
- * @param options
276
- */
277
- function parseCookies(ctx, options) {
278
- if (ctx && ctx.req && ctx.req.headers && ctx.req.headers.cookie) {
279
- return cookie.parse(ctx.req.headers.cookie, options);
280
- }
281
- if (isBrowser()) {
282
- return cookie.parse(document.cookie, options);
283
- }
284
- return {};
285
- }
286
- exports.parseCookies = parseCookies;
287
- /**
288
- *
289
- * Sets a cookie.
290
- *
291
- * @param ctx
292
- * @param name
293
- * @param value
294
- * @param options
295
- */
296
- function setCookie$1(ctx, name, value, options) {
297
- if (ctx && ctx.res && ctx.res.getHeader && ctx.res.setHeader) {
298
- var cookies = ctx.res.getHeader('Set-Cookie') || [];
299
- if (typeof cookies === 'string')
300
- cookies = [cookies];
301
- if (typeof cookies === 'number')
302
- cookies = [];
303
- var parsedCookies = setCookie.parse(cookies);
304
- var cookiesToSet_1 = [];
305
- parsedCookies.forEach(function (parsedCookie) {
306
- if (!areCookiesEqual(parsedCookie, createCookie(name, value, options))) {
307
- cookiesToSet_1.push(cookie.serialize(parsedCookie.name, parsedCookie.value, __assign({}, parsedCookie)));
308
- }
309
- });
310
- cookiesToSet_1.push(cookie.serialize(name, value, options));
311
- if (!ctx.res.finished) {
312
- ctx.res.setHeader('Set-Cookie', cookiesToSet_1);
313
- }
314
- }
315
- if (isBrowser()) {
316
- if (options && options.httpOnly) {
317
- throw new Error('Can not set a httpOnly cookie in the browser.');
318
- }
319
- document.cookie = cookie.serialize(name, value, options);
320
- }
321
- return {};
322
- }
323
- exports.setCookie = setCookie$1;
324
- /**
325
- *
326
- * Destroys a cookie with a particular name.
327
- *
328
- * @param ctx
329
- * @param name
330
- * @param options
331
- */
332
- function destroyCookie(ctx, name, options) {
333
- var opts = __assign(__assign({}, (options || {})), { maxAge: -1 });
334
- if (ctx && ctx.res && ctx.res.setHeader && ctx.res.getHeader) {
335
- var cookies = ctx.res.getHeader('Set-Cookie') || [];
336
- if (typeof cookies === 'string')
337
- cookies = [cookies];
338
- if (typeof cookies === 'number')
339
- cookies = [];
340
- cookies.push(cookie.serialize(name, '', opts));
341
- ctx.res.setHeader('Set-Cookie', cookies);
342
- }
343
- if (isBrowser()) {
344
- document.cookie = cookie.serialize(name, '', opts);
345
- }
346
- return {};
347
- }
348
- exports.destroyCookie = destroyCookie;
349
- exports.default = {
350
- set: setCookie$1,
351
- get: parseCookies,
352
- destroy: destroyCookie,
353
- };
354
-
355
- });
356
-
357
- unwrapExports(dist);
358
- var dist_1 = dist.destroyCookie;
359
- var dist_2 = dist.setCookie;
360
- var dist_3 = dist.parseCookies;
361
-
362
13
  var _this = undefined;
363
14
 
364
15
  var getRelatedArticle = function () {
@@ -435,13 +86,13 @@ var getRelatedArticle = function () {
435
86
 
436
87
 
437
88
  if (ctx && url) {
438
- cookies = dist_3(ctx);
89
+ cookies = parseCookies(ctx);
439
90
  prevSlugs = cookies['prevSlugs'];
440
91
 
441
92
  if (!!prevSlugs) {
442
- dist_2(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
93
+ setCookie(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
443
94
  filters = '&& !(url.current in [' + prevSlugs + '])';
444
- } else dist_2(ctx, 'prevSlugs', '"' + url + '"', {});
95
+ } else setCookie(ctx, 'prevSlugs', '"' + url + '"', {});
445
96
  }
446
97
 
447
98
  query = getQuery('related', filters, '', articleCount).replace('&& taxonomyMapping[]._ref in $taxonomy', '');
@@ -14,7 +14,7 @@ import './web.dom.iterable-8956f9a5.js';
14
14
  import './typeof-08f2c380.js';
15
15
  import './_is-array-49698029.js';
16
16
  import 'react';
17
- import './index-0e45a0b2.js';
17
+ import './index-a9e53f80.js';
18
18
  import 'prop-types';
19
19
  import 'react-bootstrap/Row';
20
20
  import 'react-bootstrap/Col';
@@ -41,7 +41,7 @@ import 'react-bootstrap';
41
41
  import './iconBase-602d52fe.js';
42
42
  import './index.esm-29e48d38.js';
43
43
  import 'react-bootstrap/Button';
44
- export { g as default } from './index-b2fb5cf2.js';
44
+ export { g as default } from './index-20de5762.js';
45
45
  import './util-7700fc59.js';
46
46
  import './brightcove-react-player-loader.es-83f53e4e.js';
47
47
  import 'react-bootstrap/Pagination';
@@ -4,7 +4,7 @@ import { _ as _extends$1 } from './extends-cc5da797.js';
4
4
  import { _ as _inherits$1, a as _classCallCheck$1, b as _possibleConstructorReturn$1, c as _Object$getPrototypeOf, d as _createClass$1 } from './inherits-7ee3e0c1.js';
5
5
  import { _ as _typeof } from './typeof-08f2c380.js';
6
6
  import React__default, { useState, useEffect, useRef, useLayoutEffect, useCallback } from 'react';
7
- import { l as lib_3 } from './index-0e45a0b2.js';
7
+ import { l as lib_3 } from './index-a9e53f80.js';
8
8
  import PropTypes from 'prop-types';
9
9
  import Row from 'react-bootstrap/Row';
10
10
  import Col from 'react-bootstrap/Col';
@@ -530,6 +530,7 @@ var disableInitialLoadEnabled = false;
530
530
  var lazyLoadEnabled = false;
531
531
  var lazyLoadConfig = null;
532
532
  var servePersonalizedAds = true;
533
+ var serveCookies = true;
533
534
  var registeredSlots = {};
534
535
  var managerAlreadyInitialized = false;
535
536
  var globalTargetingArguments = {};
@@ -571,9 +572,15 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
571
572
  configurePersonalizedAds: function configurePersonalizedAds(value) {
572
573
  servePersonalizedAds = value;
573
574
  },
575
+ configureCookieOption: function configureCookieOption(value) {
576
+ serveCookies = value;
577
+ },
574
578
  personalizedAdsEnabled: function personalizedAdsEnabled() {
575
579
  return servePersonalizedAds;
576
580
  },
581
+ cookiesEnabled: function cookiesEnabled() {
582
+ return serveCookies;
583
+ },
577
584
  setAdSenseAttribute: function setAdSenseAttribute(key, value) {
578
585
  this.setAdSenseAttributes(_defineProperty({}, key, value));
579
586
  },
@@ -664,6 +671,7 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
664
671
  });
665
672
  });
666
673
  pubadsService.setRequestNonPersonalizedAds(_this.personalizedAdsEnabled() ? 0 : 1);
674
+ pubadsService.setCookieOptions(_this.cookiesEnabled() ? 0 : 1);
667
675
  });
668
676
  });
669
677
  }
@@ -722,6 +730,8 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
722
730
 
723
731
  return new Promise(function (resolve) {
724
732
  _this3.getGoogletag().then(function (googletag) {
733
+ _this3.configureInitialOptions(googletag);
734
+
725
735
  slotsToInitialize.forEach(function (currentSlotId) {
726
736
  registeredSlots[currentSlotId].loading = false;
727
737
  googletag.cmd.push(function () {
@@ -773,26 +783,34 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
773
783
 
774
784
  googletag.cmd.push(function () {
775
785
  googletag.enableServices();
776
-
777
- if (!_this3.disableInitialLoadIsEnabled()) {
778
- slotsToInitialize.forEach(function (theSlotId) {
779
- googletag.display(theSlotId);
780
- });
781
- }
782
-
786
+ slotsToInitialize.forEach(function (theSlotId) {
787
+ googletag.display(theSlotId);
788
+ });
783
789
  resolve();
784
790
  });
785
791
  });
786
792
  });
787
793
  },
788
- configureOptions: function configureOptions(googletag) {
794
+ // configure those gpt parameters that need to be set before pubsads service
795
+ // initialization.
796
+ configureInitialOptions: function configureInitialOptions(googletag) {
789
797
  var _this4 = this;
790
798
 
799
+ googletag.cmd.push(function () {
800
+ if (_this4.disableInitialLoadIsEnabled()) {
801
+ googletag.pubads().disableInitialLoad();
802
+ }
803
+ });
804
+ },
805
+ configureOptions: function configureOptions(googletag) {
806
+ var _this5 = this;
807
+
791
808
  googletag.cmd.push(function () {
792
809
  var pubadsService = googletag.pubads();
793
- pubadsService.setRequestNonPersonalizedAds(_this4.personalizedAdsEnabled() ? 0 : 1);
810
+ pubadsService.setRequestNonPersonalizedAds(_this5.personalizedAdsEnabled() ? 0 : 1);
811
+ pubadsService.setCookieOptions(_this5.cookiesEnabled() ? 0 : 1);
794
812
 
795
- var targetingArguments = _this4.getTargetingArguments(); // set global targetting arguments
813
+ var targetingArguments = _this5.getTargetingArguments(); // set global targetting arguments
796
814
 
797
815
 
798
816
  Object.keys(targetingArguments).forEach(function (varName) {
@@ -801,34 +819,28 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
801
819
  }
802
820
  }); // set global adSense attributes
803
821
 
804
- var adSenseAttributes = _this4.getAdSenseAttributes();
822
+ var adSenseAttributes = _this5.getAdSenseAttributes();
805
823
 
806
824
  Object.keys(adSenseAttributes).forEach(function (key) {
807
825
  pubadsService.set(key, adSenseAttributes[key]);
808
826
  });
809
827
 
810
- if (_this4.lazyLoadIsEnabled()) {
811
- var args = [];
812
-
813
- var config = _this4.getLazyLoadConfig();
828
+ if (_this5.lazyLoadIsEnabled()) {
829
+ var config = _this5.getLazyLoadConfig();
814
830
 
815
- if (config !== null) {
816
- args.push(config);
831
+ if (config) {
832
+ pubadsService.enableLazyLoad(config);
833
+ } else {
834
+ pubadsService.enableLazyLoad();
817
835
  }
818
-
819
- pubadsService.enableLazyLoad.call(args);
820
836
  }
821
837
 
822
- if (_this4.singleRequestIsEnabled()) {
838
+ if (_this5.singleRequestIsEnabled()) {
823
839
  pubadsService.enableSingleRequest();
824
840
  }
825
841
 
826
- if (_this4.disableInitialLoadIsEnabled()) {
827
- pubadsService.disableInitialLoad();
828
- }
829
-
830
- if (_this4.collapseEmptyDivs === true || _this4.collapseEmptyDivs === false) {
831
- pubadsService.collapseEmptyDivs(_this4.collapseEmptyDivs);
842
+ if (_this5.collapseEmptyDivs === true || _this5.collapseEmptyDivs === false) {
843
+ pubadsService.collapseEmptyDivs(_this5.collapseEmptyDivs);
832
844
  }
833
845
  });
834
846
  },
@@ -863,17 +875,25 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
863
875
  }, slots);
864
876
  },
865
877
  refresh: function refresh() {
878
+ var _this6 = this;
879
+
880
+ for (var _len4 = arguments.length, slots = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
881
+ slots[_key4] = arguments[_key4];
882
+ }
883
+
866
884
  if (loadPromise === null) {
867
885
  this.load();
868
886
  } else {
869
- this.gptRefreshAds(Object.keys(this.getRefreshableSlots.apply(this, arguments)));
887
+ loadPromise.then(function () {
888
+ _this6.gptRefreshAds(Object.keys(_this6.getRefreshableSlots.apply(_this6, slots)));
889
+ });
870
890
  }
871
891
  },
872
892
  gptRefreshAds: function gptRefreshAds(slots) {
873
- var _this5 = this;
893
+ var _this7 = this;
874
894
 
875
895
  return this.getGoogletag().then(function (googletag) {
876
- _this5.configureOptions(googletag);
896
+ _this7.configureOptions(googletag);
877
897
 
878
898
  googletag.cmd.push(function () {
879
899
  var pubadsService = googletag.pubads();
@@ -884,17 +904,17 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
884
904
  });
885
905
  },
886
906
  reload: function reload() {
887
- var _this6 = this;
907
+ var _this8 = this;
888
908
 
889
909
  return this.destroyGPTSlots.apply(this, arguments).then(function () {
890
- return _this6.load();
910
+ return _this8.load();
891
911
  });
892
912
  },
893
913
  destroyGPTSlots: function destroyGPTSlots() {
894
- var _this7 = this;
914
+ var _this9 = this;
895
915
 
896
- for (var _len4 = arguments.length, slotsToDestroy = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
897
- slotsToDestroy[_key4] = arguments[_key4];
916
+ for (var _len5 = arguments.length, slotsToDestroy = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
917
+ slotsToDestroy[_key5] = arguments[_key5];
898
918
  }
899
919
 
900
920
  if (slotsToDestroy.length === 0) {
@@ -911,7 +931,7 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
911
931
  slots.push(slot);
912
932
  }
913
933
 
914
- _this7.getGoogletag().then(function (googletag) {
934
+ _this9.getGoogletag().then(function (googletag) {
915
935
  googletag.cmd.push(function () {
916
936
  if (managerAlreadyInitialized === true) {
917
937
  if (slotsToDestroy.length > 0) {
@@ -934,7 +954,7 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
934
954
  });
935
955
  },
936
956
  registerSlot: function registerSlot(_ref) {
937
- var _this8 = this;
957
+ var _this10 = this;
938
958
 
939
959
  var slotId = _ref.slotId,
940
960
  dfpNetworkId = _ref.dfpNetworkId,
@@ -973,7 +993,7 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
973
993
  gptSlot = slot.gptSlot;
974
994
 
975
995
  if (loading === false && !gptSlot) {
976
- _this8.load(slotId);
996
+ _this10.load(slotId);
977
997
  }
978
998
  }
979
999
  });
@@ -1163,6 +1183,8 @@ function (_React$Component) {
1163
1183
  value: function applyConfigs() {
1164
1184
  _manager.default.configurePersonalizedAds(this.props.personalizedAds);
1165
1185
 
1186
+ _manager.default.configureCookieOption(this.props.cookieOption);
1187
+
1166
1188
  _manager.default.configureSingleRequest(this.props.singleRequest);
1167
1189
 
1168
1190
  _manager.default.configureDisableInitialLoad(this.props.disableInitialLoad);
@@ -1259,6 +1281,7 @@ _defineProperty(DFPSlotsProvider, "propTypes", {
1259
1281
  autoReload: _propTypes.default.shape({
1260
1282
  dfpNetworkId: _propTypes.default.bool,
1261
1283
  personalizedAds: _propTypes.default.bool,
1284
+ cookieOption: _propTypes.default.bool,
1262
1285
  singleRequest: _propTypes.default.bool,
1263
1286
  disableInitialLoad: _propTypes.default.bool,
1264
1287
  adUnit: _propTypes.default.bool,
@@ -1270,6 +1293,7 @@ _defineProperty(DFPSlotsProvider, "propTypes", {
1270
1293
  }),
1271
1294
  dfpNetworkId: _propTypes.default.string.isRequired,
1272
1295
  personalizedAds: _propTypes.default.bool,
1296
+ cookieOption: _propTypes.default.bool,
1273
1297
  singleRequest: _propTypes.default.bool,
1274
1298
  disableInitialLoad: _propTypes.default.bool,
1275
1299
  adUnit: _propTypes.default.string,
@@ -1290,6 +1314,7 @@ _defineProperty(DFPSlotsProvider, "defaultProps", {
1290
1314
  autoReload: {
1291
1315
  dfpNetworkId: false,
1292
1316
  personalizedAds: false,
1317
+ cookieOption: false,
1293
1318
  singleRequest: false,
1294
1319
  disableInitialLoad: false,
1295
1320
  adUnit: false,
@@ -1300,6 +1325,7 @@ _defineProperty(DFPSlotsProvider, "defaultProps", {
1300
1325
  lazyLoad: false
1301
1326
  },
1302
1327
  personalizedAds: true,
1328
+ cookieOption: true,
1303
1329
  singleRequest: true,
1304
1330
  disableInitialLoad: false,
1305
1331
  collapseEmptyDivs: null,