@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
package/dist/cjs/View.js CHANGED
@@ -19,7 +19,7 @@ var _typeof = require('./typeof-725500bc.js');
19
19
  require('./_is-array-754e012d.js');
20
20
  var React = require('react');
21
21
  var React__default = _interopDefault(React);
22
- var index = require('./index-fa8ed292.js');
22
+ var index = require('./index-8bf6c863.js');
23
23
  require('prop-types');
24
24
  require('react-bootstrap/Row');
25
25
  require('react-bootstrap/Col');
@@ -49,7 +49,7 @@ require('./iconBase-68959171.js');
49
49
  require('./index.esm-90433435.js');
50
50
  var Button = _interopDefault(require('react-bootstrap/Button'));
51
51
  var Form = _interopDefault(require('react-bootstrap/Form'));
52
- var getSerializers = require('./index-e1275933.js');
52
+ var getSerializers = require('./index-427156b6.js');
53
53
  require('./util-f2c1b65b.js');
54
54
  require('./brightcove-react-player-loader.es-156bd4d6.js');
55
55
  require('react-bootstrap/Pagination');
@@ -62,9 +62,9 @@ var keys = require('./keys-a586b7a0.js');
62
62
  require('react-bootstrap/Dropdown');
63
63
  var index_esm$3 = require('./index.esm-ff47db6f.js');
64
64
  var getSeriesDetail = require('./getSeriesDetail.js');
65
- require('./index-bd6c9f56.js');
66
- var getRelatedArticle = require('./getRelatedArticle.js');
65
+ require('nookies');
67
66
  var getQuery = require('./getQuery.js');
67
+ var getRelatedArticle = require('./getRelatedArticle.js');
68
68
  var getTargeting = require('./getTargeting-9af0ef69.js');
69
69
  var getKeywords = require('./getKeywords.js');
70
70
  var urlFor = require('./urlFor.js');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
3
+ require('./_commonjsHelpers-06173234.js');
4
4
  require('./_to-object-329a650b.js');
5
5
  require('./es6.string.iterator-cc0bbaa4.js');
6
6
  require('./_library-dd23b178.js');
@@ -9,358 +9,9 @@ require('./core.get-iterator-method-f62321d4.js');
9
9
  require('./web.dom.iterable-a0e279c1.js');
10
10
  var asyncToGenerator = require('./asyncToGenerator-533d476a.js');
11
11
  require('./_set-species-f92c67c5.js');
12
- var index$4 = require('./index-bd6c9f56.js');
12
+ var nookies = require('nookies');
13
13
  var getQuery = require('./getQuery.js');
14
14
 
15
- var defaultParseOptions = {
16
- decodeValues: true,
17
- map: false,
18
- silent: false,
19
- };
20
-
21
- function isNonEmptyString(str) {
22
- return typeof str === "string" && !!str.trim();
23
- }
24
-
25
- function parseString(setCookieValue, options) {
26
- var parts = setCookieValue.split(";").filter(isNonEmptyString);
27
- var nameValue = parts.shift().split("=");
28
- var name = nameValue.shift();
29
- var value = nameValue.join("="); // everything after the first =, joined by a "=" if there was more than one part
30
-
31
- options = options
32
- ? Object.assign({}, defaultParseOptions, options)
33
- : defaultParseOptions;
34
-
35
- var cookie = {
36
- name: name, // grab everything before the first =
37
- value: options.decodeValues ? decodeURIComponent(value) : value, // decode cookie value
38
- };
39
-
40
- parts.forEach(function (part) {
41
- var sides = part.split("=");
42
- var key = sides.shift().trimLeft().toLowerCase();
43
- var value = sides.join("=");
44
- if (key === "expires") {
45
- cookie.expires = new Date(value);
46
- } else if (key === "max-age") {
47
- cookie.maxAge = parseInt(value, 10);
48
- } else if (key === "secure") {
49
- cookie.secure = true;
50
- } else if (key === "httponly") {
51
- cookie.httpOnly = true;
52
- } else if (key === "samesite") {
53
- cookie.sameSite = value;
54
- } else {
55
- cookie[key] = value;
56
- }
57
- });
58
-
59
- return cookie;
60
- }
61
-
62
- function parse(input, options) {
63
- options = options
64
- ? Object.assign({}, defaultParseOptions, options)
65
- : defaultParseOptions;
66
-
67
- if (!input) {
68
- if (!options.map) {
69
- return [];
70
- } else {
71
- return {};
72
- }
73
- }
74
-
75
- if (input.headers && input.headers["set-cookie"]) {
76
- // fast-path for node.js (which automatically normalizes header names to lower-case
77
- input = input.headers["set-cookie"];
78
- } else if (input.headers) {
79
- // slow-path for other environments - see #25
80
- var sch =
81
- input.headers[
82
- Object.keys(input.headers).find(function (key) {
83
- return key.toLowerCase() === "set-cookie";
84
- })
85
- ];
86
- // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
87
- if (!sch && input.headers.cookie && !options.silent) {
88
- console.warn(
89
- "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."
90
- );
91
- }
92
- input = sch;
93
- }
94
- if (!Array.isArray(input)) {
95
- input = [input];
96
- }
97
-
98
- options = options
99
- ? Object.assign({}, defaultParseOptions, options)
100
- : defaultParseOptions;
101
-
102
- if (!options.map) {
103
- return input.filter(isNonEmptyString).map(function (str) {
104
- return parseString(str, options);
105
- });
106
- } else {
107
- var cookies = {};
108
- return input.filter(isNonEmptyString).reduce(function (cookies, str) {
109
- var cookie = parseString(str, options);
110
- cookies[cookie.name] = cookie;
111
- return cookies;
112
- }, cookies);
113
- }
114
- }
115
-
116
- /*
117
- Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
118
- that are within a single set-cookie field-value, such as in the Expires portion.
119
-
120
- This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
121
- Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
122
- React Native's fetch does this for *every* header, including set-cookie.
123
-
124
- Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
125
- Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
126
- */
127
- function splitCookiesString(cookiesString) {
128
- if (Array.isArray(cookiesString)) {
129
- return cookiesString;
130
- }
131
- if (typeof cookiesString !== "string") {
132
- return [];
133
- }
134
-
135
- var cookiesStrings = [];
136
- var pos = 0;
137
- var start;
138
- var ch;
139
- var lastComma;
140
- var nextStart;
141
- var cookiesSeparatorFound;
142
-
143
- function skipWhitespace() {
144
- while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
145
- pos += 1;
146
- }
147
- return pos < cookiesString.length;
148
- }
149
-
150
- function notSpecialChar() {
151
- ch = cookiesString.charAt(pos);
152
-
153
- return ch !== "=" && ch !== ";" && ch !== ",";
154
- }
155
-
156
- while (pos < cookiesString.length) {
157
- start = pos;
158
- cookiesSeparatorFound = false;
159
-
160
- while (skipWhitespace()) {
161
- ch = cookiesString.charAt(pos);
162
- if (ch === ",") {
163
- // ',' is a cookie separator if we have later first '=', not ';' or ','
164
- lastComma = pos;
165
- pos += 1;
166
-
167
- skipWhitespace();
168
- nextStart = pos;
169
-
170
- while (pos < cookiesString.length && notSpecialChar()) {
171
- pos += 1;
172
- }
173
-
174
- // currently special character
175
- if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
176
- // we found cookies separator
177
- cookiesSeparatorFound = true;
178
- // pos is inside the next cookie, so back up and return it.
179
- pos = nextStart;
180
- cookiesStrings.push(cookiesString.substring(start, lastComma));
181
- start = pos;
182
- } else {
183
- // in param ',' or param separator ';',
184
- // we continue from that comma
185
- pos = lastComma + 1;
186
- }
187
- } else {
188
- pos += 1;
189
- }
190
- }
191
-
192
- if (!cookiesSeparatorFound || pos >= cookiesString.length) {
193
- cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
194
- }
195
- }
196
-
197
- return cookiesStrings;
198
- }
199
-
200
- var setCookie = parse;
201
- var parse_1 = parse;
202
- var parseString_1 = parseString;
203
- var splitCookiesString_1 = splitCookiesString;
204
- setCookie.parse = parse_1;
205
- setCookie.parseString = parseString_1;
206
- setCookie.splitCookiesString = splitCookiesString_1;
207
-
208
- var dist = _commonjsHelpers.createCommonjsModule(function (module, exports) {
209
- var __assign = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__assign) || function () {
210
- __assign = Object.assign || function(t) {
211
- for (var s, i = 1, n = arguments.length; i < n; i++) {
212
- s = arguments[i];
213
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
214
- t[p] = s[p];
215
- }
216
- return t;
217
- };
218
- return __assign.apply(this, arguments);
219
- };
220
- Object.defineProperty(exports, "__esModule", { value: true });
221
- exports.destroyCookie = exports.setCookie = exports.parseCookies = void 0;
222
-
223
-
224
- var isBrowser = function () { return typeof window !== 'undefined'; };
225
- function hasSameProperties(a, b) {
226
- var aProps = Object.getOwnPropertyNames(a);
227
- var bProps = Object.getOwnPropertyNames(b);
228
- if (aProps.length !== bProps.length) {
229
- return false;
230
- }
231
- for (var i = 0; i < aProps.length; i++) {
232
- var propName = aProps[i];
233
- if (a[propName] !== b[propName]) {
234
- return false;
235
- }
236
- }
237
- return true;
238
- }
239
- /**
240
- * Compare the cookie and return true if the cookies has equivalent
241
- * options and the cookies would be overwritten in the browser storage.
242
- *
243
- * @param a first Cookie for comparison
244
- * @param b second Cookie for comparison
245
- */
246
- function areCookiesEqual(a, b) {
247
- var sameSiteSame = a.sameSite === b.sameSite;
248
- if (typeof a.sameSite === 'string' && typeof b.sameSite === 'string') {
249
- sameSiteSame = a.sameSite.toLowerCase() === b.sameSite.toLowerCase();
250
- }
251
- return (hasSameProperties(__assign(__assign({}, a), { sameSite: undefined }), __assign(__assign({}, b), { sameSite: undefined })) && sameSiteSame);
252
- }
253
- /**
254
- * Create an instance of the Cookie interface
255
- *
256
- * @param name name of the Cookie
257
- * @param value value of the Cookie
258
- * @param options Cookie options
259
- */
260
- function createCookie(name, value, options) {
261
- var sameSite = options.sameSite;
262
- if (sameSite === true) {
263
- sameSite = 'strict';
264
- }
265
- if (sameSite === undefined || sameSite === false) {
266
- sameSite = 'lax';
267
- }
268
- var cookieToSet = __assign(__assign({}, options), { sameSite: sameSite });
269
- delete cookieToSet.encode;
270
- return __assign({ name: name, value: value }, cookieToSet);
271
- }
272
- /**
273
- *
274
- * Parses cookies.
275
- *
276
- * @param ctx
277
- * @param options
278
- */
279
- function parseCookies(ctx, options) {
280
- if (ctx && ctx.req && ctx.req.headers && ctx.req.headers.cookie) {
281
- return index$4.cookie.parse(ctx.req.headers.cookie, options);
282
- }
283
- if (isBrowser()) {
284
- return index$4.cookie.parse(document.cookie, options);
285
- }
286
- return {};
287
- }
288
- exports.parseCookies = parseCookies;
289
- /**
290
- *
291
- * Sets a cookie.
292
- *
293
- * @param ctx
294
- * @param name
295
- * @param value
296
- * @param options
297
- */
298
- function setCookie$1(ctx, name, value, options) {
299
- if (ctx && ctx.res && ctx.res.getHeader && ctx.res.setHeader) {
300
- var cookies = ctx.res.getHeader('Set-Cookie') || [];
301
- if (typeof cookies === 'string')
302
- cookies = [cookies];
303
- if (typeof cookies === 'number')
304
- cookies = [];
305
- var parsedCookies = setCookie.parse(cookies);
306
- var cookiesToSet_1 = [];
307
- parsedCookies.forEach(function (parsedCookie) {
308
- if (!areCookiesEqual(parsedCookie, createCookie(name, value, options))) {
309
- cookiesToSet_1.push(index$4.cookie.serialize(parsedCookie.name, parsedCookie.value, __assign({}, parsedCookie)));
310
- }
311
- });
312
- cookiesToSet_1.push(index$4.cookie.serialize(name, value, options));
313
- if (!ctx.res.finished) {
314
- ctx.res.setHeader('Set-Cookie', cookiesToSet_1);
315
- }
316
- }
317
- if (isBrowser()) {
318
- if (options && options.httpOnly) {
319
- throw new Error('Can not set a httpOnly cookie in the browser.');
320
- }
321
- document.cookie = index$4.cookie.serialize(name, value, options);
322
- }
323
- return {};
324
- }
325
- exports.setCookie = setCookie$1;
326
- /**
327
- *
328
- * Destroys a cookie with a particular name.
329
- *
330
- * @param ctx
331
- * @param name
332
- * @param options
333
- */
334
- function destroyCookie(ctx, name, options) {
335
- var opts = __assign(__assign({}, (options || {})), { maxAge: -1 });
336
- if (ctx && ctx.res && ctx.res.setHeader && ctx.res.getHeader) {
337
- var cookies = ctx.res.getHeader('Set-Cookie') || [];
338
- if (typeof cookies === 'string')
339
- cookies = [cookies];
340
- if (typeof cookies === 'number')
341
- cookies = [];
342
- cookies.push(index$4.cookie.serialize(name, '', opts));
343
- ctx.res.setHeader('Set-Cookie', cookies);
344
- }
345
- if (isBrowser()) {
346
- document.cookie = index$4.cookie.serialize(name, '', opts);
347
- }
348
- return {};
349
- }
350
- exports.destroyCookie = destroyCookie;
351
- exports.default = {
352
- set: setCookie$1,
353
- get: parseCookies,
354
- destroy: destroyCookie,
355
- };
356
-
357
- });
358
-
359
- _commonjsHelpers.unwrapExports(dist);
360
- var dist_1 = dist.destroyCookie;
361
- var dist_2 = dist.setCookie;
362
- var dist_3 = dist.parseCookies;
363
-
364
15
  var _this = undefined;
365
16
 
366
17
  var getRelatedArticle = function () {
@@ -437,13 +88,13 @@ var getRelatedArticle = function () {
437
88
 
438
89
 
439
90
  if (ctx && url) {
440
- cookies = dist_3(ctx);
91
+ cookies = nookies.parseCookies(ctx);
441
92
  prevSlugs = cookies['prevSlugs'];
442
93
 
443
94
  if (!!prevSlugs) {
444
- dist_2(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
95
+ nookies.setCookie(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
445
96
  filters = '&& !(url.current in [' + prevSlugs + '])';
446
- } else dist_2(ctx, 'prevSlugs', '"' + url + '"', {});
97
+ } else nookies.setCookie(ctx, 'prevSlugs', '"' + url + '"', {});
447
98
  }
448
99
 
449
100
  query = getQuery('related', filters, '', articleCount).replace('&& taxonomyMapping[]._ref in $taxonomy', '');
@@ -16,7 +16,7 @@ require('./web.dom.iterable-a0e279c1.js');
16
16
  require('./typeof-725500bc.js');
17
17
  require('./_is-array-754e012d.js');
18
18
  require('react');
19
- require('./index-fa8ed292.js');
19
+ require('./index-8bf6c863.js');
20
20
  require('prop-types');
21
21
  require('react-bootstrap/Row');
22
22
  require('react-bootstrap/Col');
@@ -43,7 +43,7 @@ require('react-bootstrap');
43
43
  require('./iconBase-68959171.js');
44
44
  require('./index.esm-90433435.js');
45
45
  require('react-bootstrap/Button');
46
- var getSerializers = require('./index-e1275933.js');
46
+ var getSerializers = require('./index-427156b6.js');
47
47
  require('./util-f2c1b65b.js');
48
48
  require('./brightcove-react-player-loader.es-156bd4d6.js');
49
49
  require('react-bootstrap/Pagination');
@@ -9,7 +9,7 @@ var inherits = require('./inherits-c9f99d47.js');
9
9
  var _typeof = require('./typeof-725500bc.js');
10
10
  var React = require('react');
11
11
  var React__default = _interopDefault(React);
12
- var index = require('./index-fa8ed292.js');
12
+ var index = require('./index-8bf6c863.js');
13
13
  var PropTypes = require('prop-types');
14
14
  var PropTypes__default = _interopDefault(PropTypes);
15
15
  var Row = _interopDefault(require('react-bootstrap/Row'));
@@ -536,6 +536,7 @@ var disableInitialLoadEnabled = false;
536
536
  var lazyLoadEnabled = false;
537
537
  var lazyLoadConfig = null;
538
538
  var servePersonalizedAds = true;
539
+ var serveCookies = true;
539
540
  var registeredSlots = {};
540
541
  var managerAlreadyInitialized = false;
541
542
  var globalTargetingArguments = {};
@@ -577,9 +578,15 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
577
578
  configurePersonalizedAds: function configurePersonalizedAds(value) {
578
579
  servePersonalizedAds = value;
579
580
  },
581
+ configureCookieOption: function configureCookieOption(value) {
582
+ serveCookies = value;
583
+ },
580
584
  personalizedAdsEnabled: function personalizedAdsEnabled() {
581
585
  return servePersonalizedAds;
582
586
  },
587
+ cookiesEnabled: function cookiesEnabled() {
588
+ return serveCookies;
589
+ },
583
590
  setAdSenseAttribute: function setAdSenseAttribute(key, value) {
584
591
  this.setAdSenseAttributes(_defineProperty({}, key, value));
585
592
  },
@@ -670,6 +677,7 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
670
677
  });
671
678
  });
672
679
  pubadsService.setRequestNonPersonalizedAds(_this.personalizedAdsEnabled() ? 0 : 1);
680
+ pubadsService.setCookieOptions(_this.cookiesEnabled() ? 0 : 1);
673
681
  });
674
682
  });
675
683
  }
@@ -728,6 +736,8 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
728
736
 
729
737
  return new Promise(function (resolve) {
730
738
  _this3.getGoogletag().then(function (googletag) {
739
+ _this3.configureInitialOptions(googletag);
740
+
731
741
  slotsToInitialize.forEach(function (currentSlotId) {
732
742
  registeredSlots[currentSlotId].loading = false;
733
743
  googletag.cmd.push(function () {
@@ -779,26 +789,34 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
779
789
 
780
790
  googletag.cmd.push(function () {
781
791
  googletag.enableServices();
782
-
783
- if (!_this3.disableInitialLoadIsEnabled()) {
784
- slotsToInitialize.forEach(function (theSlotId) {
785
- googletag.display(theSlotId);
786
- });
787
- }
788
-
792
+ slotsToInitialize.forEach(function (theSlotId) {
793
+ googletag.display(theSlotId);
794
+ });
789
795
  resolve();
790
796
  });
791
797
  });
792
798
  });
793
799
  },
794
- configureOptions: function configureOptions(googletag) {
800
+ // configure those gpt parameters that need to be set before pubsads service
801
+ // initialization.
802
+ configureInitialOptions: function configureInitialOptions(googletag) {
795
803
  var _this4 = this;
796
804
 
805
+ googletag.cmd.push(function () {
806
+ if (_this4.disableInitialLoadIsEnabled()) {
807
+ googletag.pubads().disableInitialLoad();
808
+ }
809
+ });
810
+ },
811
+ configureOptions: function configureOptions(googletag) {
812
+ var _this5 = this;
813
+
797
814
  googletag.cmd.push(function () {
798
815
  var pubadsService = googletag.pubads();
799
- pubadsService.setRequestNonPersonalizedAds(_this4.personalizedAdsEnabled() ? 0 : 1);
816
+ pubadsService.setRequestNonPersonalizedAds(_this5.personalizedAdsEnabled() ? 0 : 1);
817
+ pubadsService.setCookieOptions(_this5.cookiesEnabled() ? 0 : 1);
800
818
 
801
- var targetingArguments = _this4.getTargetingArguments(); // set global targetting arguments
819
+ var targetingArguments = _this5.getTargetingArguments(); // set global targetting arguments
802
820
 
803
821
 
804
822
  Object.keys(targetingArguments).forEach(function (varName) {
@@ -807,34 +825,28 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
807
825
  }
808
826
  }); // set global adSense attributes
809
827
 
810
- var adSenseAttributes = _this4.getAdSenseAttributes();
828
+ var adSenseAttributes = _this5.getAdSenseAttributes();
811
829
 
812
830
  Object.keys(adSenseAttributes).forEach(function (key) {
813
831
  pubadsService.set(key, adSenseAttributes[key]);
814
832
  });
815
833
 
816
- if (_this4.lazyLoadIsEnabled()) {
817
- var args = [];
818
-
819
- var config = _this4.getLazyLoadConfig();
834
+ if (_this5.lazyLoadIsEnabled()) {
835
+ var config = _this5.getLazyLoadConfig();
820
836
 
821
- if (config !== null) {
822
- args.push(config);
837
+ if (config) {
838
+ pubadsService.enableLazyLoad(config);
839
+ } else {
840
+ pubadsService.enableLazyLoad();
823
841
  }
824
-
825
- pubadsService.enableLazyLoad.call(args);
826
842
  }
827
843
 
828
- if (_this4.singleRequestIsEnabled()) {
844
+ if (_this5.singleRequestIsEnabled()) {
829
845
  pubadsService.enableSingleRequest();
830
846
  }
831
847
 
832
- if (_this4.disableInitialLoadIsEnabled()) {
833
- pubadsService.disableInitialLoad();
834
- }
835
-
836
- if (_this4.collapseEmptyDivs === true || _this4.collapseEmptyDivs === false) {
837
- pubadsService.collapseEmptyDivs(_this4.collapseEmptyDivs);
848
+ if (_this5.collapseEmptyDivs === true || _this5.collapseEmptyDivs === false) {
849
+ pubadsService.collapseEmptyDivs(_this5.collapseEmptyDivs);
838
850
  }
839
851
  });
840
852
  },
@@ -869,17 +881,25 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
869
881
  }, slots);
870
882
  },
871
883
  refresh: function refresh() {
884
+ var _this6 = this;
885
+
886
+ for (var _len4 = arguments.length, slots = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
887
+ slots[_key4] = arguments[_key4];
888
+ }
889
+
872
890
  if (loadPromise === null) {
873
891
  this.load();
874
892
  } else {
875
- this.gptRefreshAds(Object.keys(this.getRefreshableSlots.apply(this, arguments)));
893
+ loadPromise.then(function () {
894
+ _this6.gptRefreshAds(Object.keys(_this6.getRefreshableSlots.apply(_this6, slots)));
895
+ });
876
896
  }
877
897
  },
878
898
  gptRefreshAds: function gptRefreshAds(slots) {
879
- var _this5 = this;
899
+ var _this7 = this;
880
900
 
881
901
  return this.getGoogletag().then(function (googletag) {
882
- _this5.configureOptions(googletag);
902
+ _this7.configureOptions(googletag);
883
903
 
884
904
  googletag.cmd.push(function () {
885
905
  var pubadsService = googletag.pubads();
@@ -890,17 +910,17 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
890
910
  });
891
911
  },
892
912
  reload: function reload() {
893
- var _this6 = this;
913
+ var _this8 = this;
894
914
 
895
915
  return this.destroyGPTSlots.apply(this, arguments).then(function () {
896
- return _this6.load();
916
+ return _this8.load();
897
917
  });
898
918
  },
899
919
  destroyGPTSlots: function destroyGPTSlots() {
900
- var _this7 = this;
920
+ var _this9 = this;
901
921
 
902
- for (var _len4 = arguments.length, slotsToDestroy = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
903
- slotsToDestroy[_key4] = arguments[_key4];
922
+ for (var _len5 = arguments.length, slotsToDestroy = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
923
+ slotsToDestroy[_key5] = arguments[_key5];
904
924
  }
905
925
 
906
926
  if (slotsToDestroy.length === 0) {
@@ -917,7 +937,7 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
917
937
  slots.push(slot);
918
938
  }
919
939
 
920
- _this7.getGoogletag().then(function (googletag) {
940
+ _this9.getGoogletag().then(function (googletag) {
921
941
  googletag.cmd.push(function () {
922
942
  if (managerAlreadyInitialized === true) {
923
943
  if (slotsToDestroy.length > 0) {
@@ -940,7 +960,7 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
940
960
  });
941
961
  },
942
962
  registerSlot: function registerSlot(_ref) {
943
- var _this8 = this;
963
+ var _this10 = this;
944
964
 
945
965
  var slotId = _ref.slotId,
946
966
  dfpNetworkId = _ref.dfpNetworkId,
@@ -979,7 +999,7 @@ var DFPManager = Object.assign(new EventEmitter.EventEmitter().setMaxListeners(0
979
999
  gptSlot = slot.gptSlot;
980
1000
 
981
1001
  if (loading === false && !gptSlot) {
982
- _this8.load(slotId);
1002
+ _this10.load(slotId);
983
1003
  }
984
1004
  }
985
1005
  });
@@ -1169,6 +1189,8 @@ function (_React$Component) {
1169
1189
  value: function applyConfigs() {
1170
1190
  _manager.default.configurePersonalizedAds(this.props.personalizedAds);
1171
1191
 
1192
+ _manager.default.configureCookieOption(this.props.cookieOption);
1193
+
1172
1194
  _manager.default.configureSingleRequest(this.props.singleRequest);
1173
1195
 
1174
1196
  _manager.default.configureDisableInitialLoad(this.props.disableInitialLoad);
@@ -1265,6 +1287,7 @@ _defineProperty(DFPSlotsProvider, "propTypes", {
1265
1287
  autoReload: _propTypes.default.shape({
1266
1288
  dfpNetworkId: _propTypes.default.bool,
1267
1289
  personalizedAds: _propTypes.default.bool,
1290
+ cookieOption: _propTypes.default.bool,
1268
1291
  singleRequest: _propTypes.default.bool,
1269
1292
  disableInitialLoad: _propTypes.default.bool,
1270
1293
  adUnit: _propTypes.default.bool,
@@ -1276,6 +1299,7 @@ _defineProperty(DFPSlotsProvider, "propTypes", {
1276
1299
  }),
1277
1300
  dfpNetworkId: _propTypes.default.string.isRequired,
1278
1301
  personalizedAds: _propTypes.default.bool,
1302
+ cookieOption: _propTypes.default.bool,
1279
1303
  singleRequest: _propTypes.default.bool,
1280
1304
  disableInitialLoad: _propTypes.default.bool,
1281
1305
  adUnit: _propTypes.default.string,
@@ -1296,6 +1320,7 @@ _defineProperty(DFPSlotsProvider, "defaultProps", {
1296
1320
  autoReload: {
1297
1321
  dfpNetworkId: false,
1298
1322
  personalizedAds: false,
1323
+ cookieOption: false,
1299
1324
  singleRequest: false,
1300
1325
  disableInitialLoad: false,
1301
1326
  adUnit: false,
@@ -1306,6 +1331,7 @@ _defineProperty(DFPSlotsProvider, "defaultProps", {
1306
1331
  lazyLoad: false
1307
1332
  },
1308
1333
  personalizedAds: true,
1334
+ cookieOption: true,
1309
1335
  singleRequest: true,
1310
1336
  disableInitialLoad: false,
1311
1337
  collapseEmptyDivs: null,