@mjhls/mjh-framework 1.0.694-beta.3 → 1.0.695

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 (150) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/AD.js +1 -1
  3. package/dist/cjs/AD300x250.js +3 -3
  4. package/dist/cjs/AD300x250x600.js +3 -3
  5. package/dist/cjs/AD728x90.js +4 -4
  6. package/dist/cjs/ADFloatingFooter.js +2 -2
  7. package/dist/cjs/ADGutter.js +2 -2
  8. package/dist/cjs/ADSkyscraper.js +2 -2
  9. package/dist/cjs/ADSponsoredResources.js +2 -2
  10. package/dist/cjs/ADWebcast.js +2 -2
  11. package/dist/cjs/ADWelcome.js +2 -2
  12. package/dist/cjs/AdSlot.js +2 -2
  13. package/dist/cjs/AdSlotsProvider.js +1 -1
  14. package/dist/cjs/ArticleCarousel.js +1 -1
  15. package/dist/cjs/ArticleSeriesListing.js +5 -5
  16. package/dist/cjs/Auth.js +301 -250
  17. package/dist/cjs/{BlockContent-091a991f.js → BlockContent-88f69acd.js} +1 -1
  18. package/dist/cjs/BrowseVideosListing.js +1 -1
  19. package/dist/cjs/CMEDeck.js +5 -5
  20. package/dist/cjs/Column3.js +4 -4
  21. package/dist/cjs/ConferenceArticleCard.js +2 -2
  22. package/dist/cjs/DeckContent.js +7 -7
  23. package/dist/cjs/DeckQueue.js +6 -6
  24. package/dist/cjs/{Dfp-f6a18ed2.js → Dfp-b2bc3b97.js} +1 -1
  25. package/dist/cjs/EventsDeck.js +4 -4
  26. package/dist/cjs/ExternalResources.js +7 -7
  27. package/dist/cjs/Feature.js +3 -3
  28. package/dist/cjs/ForbesHero.js +2 -2
  29. package/dist/cjs/GridContent.js +10 -10
  30. package/dist/cjs/GridHero.js +2 -2
  31. package/dist/cjs/GroupDeck.js +1 -1
  32. package/dist/cjs/HamMagazine.js +4 -4
  33. package/dist/cjs/Hero.js +1 -1
  34. package/dist/cjs/HorizontalHero.js +2 -2
  35. package/dist/cjs/IssueContentDeck.js +2 -2
  36. package/dist/cjs/IssueDeck.js +2 -2
  37. package/dist/cjs/IssueLanding.js +7 -7
  38. package/dist/cjs/LeftNav.js +2 -2
  39. package/dist/cjs/MasterDeck.js +7 -7
  40. package/dist/cjs/NavMagazine.js +4 -4
  41. package/dist/cjs/NavNative.js +3 -3
  42. package/dist/cjs/OncliveHero.js +2 -2
  43. package/dist/cjs/OncliveLargeHero.js +2 -2
  44. package/dist/cjs/PartnerDetailListing.js +16 -16
  45. package/dist/cjs/PublicationDeck.js +1 -1
  46. package/dist/cjs/QueueDeckExpanded.js +9 -9
  47. package/dist/cjs/RecentNews.js +2 -2
  48. package/dist/cjs/RelatedContent.js +2 -2
  49. package/dist/cjs/{SocialSearchComponent-9cd24578.js → SocialSearchComponent-6b5e5b47.js} +5 -5
  50. package/dist/cjs/TaxonomyCard.js +2 -2
  51. package/dist/cjs/TemplateNormal.js +3 -3
  52. package/dist/cjs/ThumbnailCard.js +1 -1
  53. package/dist/cjs/Ustream.js +2 -2
  54. package/dist/cjs/VerticalHero.js +2 -2
  55. package/dist/cjs/VideoSeriesCard.js +2 -2
  56. package/dist/cjs/VideoSeriesListing.js +5 -5
  57. package/dist/cjs/View.js +214 -175
  58. package/dist/cjs/YahooHero.js +2 -2
  59. package/dist/cjs/YoutubeGroup.js +1 -1
  60. package/dist/cjs/getQuery.js +2 -2
  61. package/dist/cjs/getRelatedArticle.js +156 -137
  62. package/dist/cjs/getSerializers.js +6 -6
  63. package/dist/cjs/{getTargeting-9af0ef69.js → getTargeting-fee8c429.js} +2 -2
  64. package/dist/cjs/getTargeting.js +1 -1
  65. package/dist/cjs/{index-fa8ed292.js → index-2d0a4911.js} +34 -27
  66. package/dist/cjs/{index-3294d3bc.js → index-5be2866f.js} +1 -1
  67. package/dist/cjs/{index-be0c82be.js → index-b5eb3ff8.js} +20 -19
  68. package/dist/cjs/{index-a5919bab.js → index-c0bfab13.js} +512 -475
  69. package/dist/cjs/{index.es-9110add6.js → index.es-ab3f2690.js} +3 -1
  70. package/dist/cjs/index.js +12 -12
  71. package/dist/cjs/{main-a4cb15bb.js → main-b6c96c8d.js} +67 -36
  72. package/dist/cjs/{moment-575fe24c.js → moment-66a6a284.js} +1 -1
  73. package/dist/cjs/timeDifferenceCalc.js +1 -1
  74. package/dist/cjs/urlFor.js +1 -1
  75. package/dist/esm/AD.js +1 -1
  76. package/dist/esm/AD300x250.js +3 -3
  77. package/dist/esm/AD300x250x600.js +3 -3
  78. package/dist/esm/AD728x90.js +4 -4
  79. package/dist/esm/ADFloatingFooter.js +2 -2
  80. package/dist/esm/ADGutter.js +2 -2
  81. package/dist/esm/ADSkyscraper.js +2 -2
  82. package/dist/esm/ADSponsoredResources.js +2 -2
  83. package/dist/esm/ADWebcast.js +2 -2
  84. package/dist/esm/ADWelcome.js +2 -2
  85. package/dist/esm/AdSlot.js +2 -2
  86. package/dist/esm/AdSlotsProvider.js +1 -1
  87. package/dist/esm/ArticleCarousel.js +1 -1
  88. package/dist/esm/ArticleSeriesListing.js +5 -5
  89. package/dist/esm/Auth.js +298 -247
  90. package/dist/esm/{BlockContent-e9b4ddcf.js → BlockContent-a614acdf.js} +1 -1
  91. package/dist/esm/BrowseVideosListing.js +1 -1
  92. package/dist/esm/CMEDeck.js +5 -5
  93. package/dist/esm/Column3.js +4 -4
  94. package/dist/esm/ConferenceArticleCard.js +2 -2
  95. package/dist/esm/DeckContent.js +7 -7
  96. package/dist/esm/DeckQueue.js +6 -6
  97. package/dist/esm/{Dfp-96b49def.js → Dfp-8a8fca18.js} +1 -1
  98. package/dist/esm/EventsDeck.js +4 -4
  99. package/dist/esm/ExternalResources.js +7 -7
  100. package/dist/esm/Feature.js +3 -3
  101. package/dist/esm/ForbesHero.js +2 -2
  102. package/dist/esm/GridContent.js +10 -10
  103. package/dist/esm/GridHero.js +2 -2
  104. package/dist/esm/GroupDeck.js +1 -1
  105. package/dist/esm/HamMagazine.js +4 -4
  106. package/dist/esm/Hero.js +1 -1
  107. package/dist/esm/HorizontalHero.js +2 -2
  108. package/dist/esm/IssueContentDeck.js +2 -2
  109. package/dist/esm/IssueDeck.js +2 -2
  110. package/dist/esm/IssueLanding.js +7 -7
  111. package/dist/esm/LeftNav.js +2 -2
  112. package/dist/esm/MasterDeck.js +7 -7
  113. package/dist/esm/NavMagazine.js +4 -4
  114. package/dist/esm/NavNative.js +3 -3
  115. package/dist/esm/OncliveHero.js +2 -2
  116. package/dist/esm/OncliveLargeHero.js +2 -2
  117. package/dist/esm/PartnerDetailListing.js +14 -14
  118. package/dist/esm/PublicationDeck.js +1 -1
  119. package/dist/esm/QueueDeckExpanded.js +9 -9
  120. package/dist/esm/RecentNews.js +2 -2
  121. package/dist/esm/RelatedContent.js +2 -2
  122. package/dist/esm/{SocialSearchComponent-93233334.js → SocialSearchComponent-7f14e0f3.js} +5 -5
  123. package/dist/esm/TaxonomyCard.js +2 -2
  124. package/dist/esm/TemplateNormal.js +3 -3
  125. package/dist/esm/ThumbnailCard.js +1 -1
  126. package/dist/esm/Ustream.js +2 -2
  127. package/dist/esm/VerticalHero.js +2 -2
  128. package/dist/esm/VideoSeriesCard.js +2 -2
  129. package/dist/esm/VideoSeriesListing.js +5 -5
  130. package/dist/esm/View.js +189 -150
  131. package/dist/esm/YahooHero.js +2 -2
  132. package/dist/esm/YoutubeGroup.js +1 -1
  133. package/dist/esm/getQuery.js +2 -2
  134. package/dist/esm/getRelatedArticle.js +156 -137
  135. package/dist/esm/getSerializers.js +6 -6
  136. package/dist/esm/{index-73819142.js → index-51a80699.js} +20 -19
  137. package/dist/esm/{index-c376cd8e.js → index-754010eb.js} +512 -475
  138. package/dist/esm/{index-0e45a0b2.js → index-93ec3c59.js} +34 -27
  139. package/dist/esm/{index-ef6d5dcf.js → index-d2f90501.js} +1 -1
  140. package/dist/esm/{index.es-29c1cef5.js → index.es-938a3a58.js} +3 -1
  141. package/dist/esm/index.js +11 -11
  142. package/dist/esm/{main-5d1e4bd3.js → main-0465b2a0.js} +65 -34
  143. package/dist/esm/{moment-e2f9b20c.js → moment-12415288.js} +1 -1
  144. package/dist/esm/timeDifferenceCalc.js +1 -1
  145. package/dist/esm/urlFor.js +1 -1
  146. package/package.json +1 -1
  147. /package/dist/cjs/{ADInfeed-2fe7211c.js → ADInfeed-3410ab3c.js} +0 -0
  148. /package/dist/cjs/{ADlgInfeed-14e17b43.js → ADlgInfeed-845aac15.js} +0 -0
  149. /package/dist/esm/{ADInfeed-eae71d07.js → ADInfeed-205cb7a9.js} +0 -0
  150. /package/dist/esm/{ADlgInfeed-c619fe64.js → ADlgInfeed-e538f17a.js} +0 -0
@@ -10,9 +10,9 @@ var getQuery = function getQuery(type) {
10
10
 
11
11
  switch (type) {
12
12
  case 'related':
13
- return '*[\n _type == "article"\n && defined(title)\n && defined(url)\n && !(_id in path("drafts.**"))\n && is_visible == true\n && defined(published) \n && dateTime(published) <= dateTime(now())\n && passwordLock!=true\n && taxonomyMapping[]._ref in $taxonomy\n && taxonomyMapping[].disableAds != \'true\'\n && contentCategory->.name != \'Poll\'\n && contentCategory->.name != \'Slideshows\'\n && contentCategory->.disableAds != \'true\'\n && ExcludeFromInfiniteScroll !=true\n && url.current != $url\n ' + conditions + '\n && !defined(body[].videos)\n ]| order(published desc)[' + (articleCount ? articleCount : '$index') + ']{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n _id,\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n disableAds\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n _id,\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n }';
13
+ return '*[\n _type == "article"\n && defined(title)\n && defined(url)\n && !(_id in path("drafts.**"))\n && is_visible == true\n && defined(published) \n && dateTime(published) <= dateTime(now())\n && passwordLock!=true\n && taxonomyMapping[]._ref in $taxonomy\n && taxonomyMapping[].disableAds != \'true\'\n && contentCategory->.name != \'Poll\'\n && contentCategory->.name != \'Slideshows\'\n && contentCategory->.disableAds != \'true\'\n && ExcludeFromInfiniteScroll !=true\n && url.current != $url\n && !defined(body[].videos)\n ' + conditions + '\n ]| order(published desc)[' + (articleCount ? articleCount : '$index') + ']{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n disableAds\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n }';
14
14
  case 'article':
15
- return '*[\n _type == "article"\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n },\n medias[]{\n ...,\n upload_doc {\n _type,\n asset-> \n } \n },\n articles[]{\n ...,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n text[]{\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n },\n }\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n ...,\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n _id,\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'category\':contentCategory->{\n name,\n disableAds\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n volume,\n \'issueNumber\': number,\n \'articleSource\': source,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n\n }';
15
+ return '*[\n _type == "article"\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n },\n medias[]{\n ...,\n upload_doc {\n _type,\n asset-> \n } \n },\n articles[]{\n ...,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n text[]{\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n },\n }\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n ...,\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'category\':contentCategory->{\n name,\n disableAds\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n volume,\n \'issueNumber\': number,\n \'articleSource\': source,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n\n }';
16
16
  case 'publication':
17
17
  return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issues\': *[_type == \'publication\'\n && is_visible\n && references(^._id)\n && defined(identifier)] {\n ...,\n pdf{asset->}\n } | order(year desc, month desc)\n }';
18
18
  case 'issue':
@@ -32,9 +32,18 @@ function parseString(setCookieValue, options) {
32
32
  ? Object.assign({}, defaultParseOptions, options)
33
33
  : defaultParseOptions;
34
34
 
35
+ try {
36
+ value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value
37
+ } catch (e) {
38
+ console.error(
39
+ `set-cookie-parser encountered an error while decoding a cookie with value '${value}'. Set options.decodeValues to false to disable this feature.`,
40
+ e
41
+ );
42
+ }
43
+
35
44
  var cookie = {
36
45
  name: name, // grab everything before the first =
37
- value: options.decodeValues ? decodeURIComponent(value) : value, // decode cookie value
46
+ value: value,
38
47
  };
39
48
 
40
49
  parts.forEach(function (part) {
@@ -205,7 +214,7 @@ setCookie.parse = parse_1;
205
214
  setCookie.parseString = parseString_1;
206
215
  setCookie.splitCookiesString = splitCookiesString_1;
207
216
 
208
- var dist = _commonjsHelpers.createCommonjsModule(function (module, exports) {
217
+ var utils = _commonjsHelpers.createCommonjsModule(function (module, exports) {
209
218
  var __assign = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__assign) || function () {
210
219
  __assign = Object.assign || function(t) {
211
220
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -218,10 +227,33 @@ var __assign = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlob
218
227
  return __assign.apply(this, arguments);
219
228
  };
220
229
  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'; };
230
+ exports.areCookiesEqual = exports.hasSameProperties = exports.createCookie = exports.isBrowser = void 0;
231
+ /**
232
+ * Tells whether we are in a browser or server.
233
+ */
234
+ function isBrowser() {
235
+ return typeof window !== 'undefined';
236
+ }
237
+ exports.isBrowser = isBrowser;
238
+ /**
239
+ * Create an instance of the Cookie interface
240
+ */
241
+ function createCookie(name, value, options) {
242
+ var sameSite = options.sameSite;
243
+ if (sameSite === true) {
244
+ sameSite = 'strict';
245
+ }
246
+ if (sameSite === undefined || sameSite === false) {
247
+ sameSite = 'lax';
248
+ }
249
+ var cookieToSet = __assign(__assign({}, options), { sameSite: sameSite });
250
+ delete cookieToSet.encode;
251
+ return __assign({ name: name, value: value }, cookieToSet);
252
+ }
253
+ exports.createCookie = createCookie;
254
+ /**
255
+ * Tells whether given objects have the same properties.
256
+ */
225
257
  function hasSameProperties(a, b) {
226
258
  var aProps = Object.getOwnPropertyNames(a);
227
259
  var bProps = Object.getOwnPropertyNames(b);
@@ -236,8 +268,9 @@ function hasSameProperties(a, b) {
236
268
  }
237
269
  return true;
238
270
  }
271
+ exports.hasSameProperties = hasSameProperties;
239
272
  /**
240
- * Compare the cookie and return true if the cookies has equivalent
273
+ * Compare the cookie and return true if the cookies have equivalent
241
274
  * options and the cookies would be overwritten in the browser storage.
242
275
  *
243
276
  * @param a first Cookie for comparison
@@ -250,71 +283,109 @@ function areCookiesEqual(a, b) {
250
283
  }
251
284
  return (hasSameProperties(__assign(__assign({}, a), { sameSite: undefined }), __assign(__assign({}, b), { sameSite: undefined })) && sameSiteSame);
252
285
  }
286
+ exports.areCookiesEqual = areCookiesEqual;
287
+ /* Functions */
288
+
289
+ });
290
+
291
+ _commonjsHelpers.unwrapExports(utils);
292
+ var utils_1 = utils.areCookiesEqual;
293
+ var utils_2 = utils.hasSameProperties;
294
+ var utils_3 = utils.createCookie;
295
+ var utils_4 = utils.isBrowser;
296
+
297
+ var dist = _commonjsHelpers.createCommonjsModule(function (module, exports) {
298
+ var __assign = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__assign) || function () {
299
+ __assign = Object.assign || function(t) {
300
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
301
+ s = arguments[i];
302
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
303
+ t[p] = s[p];
304
+ }
305
+ return t;
306
+ };
307
+ return __assign.apply(this, arguments);
308
+ };
309
+ Object.defineProperty(exports, "__esModule", { value: true });
310
+ exports.destroyCookie = exports.setCookie = exports.parseCookies = void 0;
311
+
312
+
313
+
253
314
  /**
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
315
  * Parses cookies.
275
316
  *
276
- * @param ctx
277
- * @param options
317
+ * @param ctx NextJS page or API context, express context, null or undefined.
318
+ * @param options Options that we pass down to `cookie` library.
278
319
  */
279
320
  function parseCookies(ctx, options) {
280
- if (ctx && ctx.req && ctx.req.headers && ctx.req.headers.cookie) {
321
+ var _a, _b;
322
+ if ((_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.req) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.cookie) {
281
323
  return index$4.cookie.parse(ctx.req.headers.cookie, options);
282
324
  }
283
- if (isBrowser()) {
325
+ if (utils.isBrowser()) {
284
326
  return index$4.cookie.parse(document.cookie, options);
285
327
  }
286
328
  return {};
287
329
  }
288
330
  exports.parseCookies = parseCookies;
289
331
  /**
290
- *
291
332
  * Sets a cookie.
292
333
  *
293
- * @param ctx
294
- * @param name
295
- * @param value
296
- * @param options
334
+ * @param ctx NextJS page or API context, express context, null or undefined.
335
+ * @param name The name of your cookie.
336
+ * @param value The value of your cookie.
337
+ * @param options Options that we pass down to `cookie` library.
297
338
  */
298
339
  function setCookie$1(ctx, name, value, options) {
299
- if (ctx && ctx.res && ctx.res.getHeader && ctx.res.setHeader) {
340
+ var _a, _b;
341
+ if (options === void 0) { options = {}; }
342
+ // SSR
343
+ if (((_a = ctx === null || ctx === void 0 ? void 0 : ctx.res) === null || _a === void 0 ? void 0 : _a.getHeader) && ctx.res.setHeader) {
344
+ // Check if response has finished and warn about it.
345
+ if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.res) === null || _b === void 0 ? void 0 : _b.finished) {
346
+ console.warn("Not setting \"" + name + "\" cookie. Response has finished.");
347
+ console.warn("You should set cookie before res.send()");
348
+ return {};
349
+ }
350
+ /**
351
+ * Load existing cookies from the header and parse them.
352
+ */
300
353
  var cookies = ctx.res.getHeader('Set-Cookie') || [];
301
354
  if (typeof cookies === 'string')
302
355
  cookies = [cookies];
303
356
  if (typeof cookies === 'number')
304
357
  cookies = [];
305
- var parsedCookies = setCookie.parse(cookies);
358
+ /**
359
+ * Parse cookies but ignore values - we've already encoded
360
+ * them in the previous call.
361
+ */
362
+ var parsedCookies = setCookie.parse(cookies, {
363
+ decodeValues: false,
364
+ });
365
+ /**
366
+ * We create the new cookie and make sure that none of
367
+ * the existing cookies match it.
368
+ */
369
+ var newCookie_1 = utils.createCookie(name, value, options);
306
370
  var cookiesToSet_1 = [];
307
371
  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)));
372
+ if (!utils.areCookiesEqual(parsedCookie, newCookie_1)) {
373
+ /**
374
+ * We serialize the cookie back to the original format
375
+ * if it isn't the same as the new one.
376
+ */
377
+ var serializedCookie = index$4.cookie.serialize(parsedCookie.name, parsedCookie.value, __assign({
378
+ // we prevent reencoding by default, but you might override it
379
+ encode: function (val) { return val; } }, parsedCookie));
380
+ cookiesToSet_1.push(serializedCookie);
310
381
  }
311
382
  });
312
383
  cookiesToSet_1.push(index$4.cookie.serialize(name, value, options));
313
- if (!ctx.res.finished) {
314
- ctx.res.setHeader('Set-Cookie', cookiesToSet_1);
315
- }
384
+ // Update the header.
385
+ ctx.res.setHeader('Set-Cookie', cookiesToSet_1);
316
386
  }
317
- if (isBrowser()) {
387
+ // Browser
388
+ if (utils.isBrowser()) {
318
389
  if (options && options.httpOnly) {
319
390
  throw new Error('Can not set a httpOnly cookie in the browser.');
320
391
  }
@@ -324,30 +395,21 @@ function setCookie$1(ctx, name, value, options) {
324
395
  }
325
396
  exports.setCookie = setCookie$1;
326
397
  /**
327
- *
328
398
  * Destroys a cookie with a particular name.
329
399
  *
330
- * @param ctx
331
- * @param name
332
- * @param options
400
+ * @param ctx NextJS page or API context, express context, null or undefined.
401
+ * @param name Cookie name.
402
+ * @param options Options that we pass down to `cookie` library.
333
403
  */
334
404
  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 {};
405
+ /**
406
+ * We forward the request destroy to setCookie function
407
+ * as it is the same function with modified maxAge value.
408
+ */
409
+ return setCookie$1(ctx, name, '', __assign(__assign({}, (options || {})), { maxAge: -1 }));
349
410
  }
350
411
  exports.destroyCookie = destroyCookie;
412
+ /* Utility Exports */
351
413
  exports.default = {
352
414
  set: setCookie$1,
353
415
  get: parseCookies,
@@ -364,33 +426,28 @@ var dist_3 = dist.parseCookies;
364
426
  var _this = undefined;
365
427
 
366
428
  var getRelatedArticle = function () {
367
- var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
429
+ var _ref2 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
368
430
  var ctx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
369
431
  var client = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
370
432
  var article = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
371
433
  var prevUrl = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
372
434
  var articleCount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
373
435
 
374
- var _article$url, url, documentGroupMapping, issueGroup, content_placement, references, params, articles, filters, cookies, prevSlugs, referenceFilter, query;
436
+ var taxonomyMapping, _article$url, url, content_placement, taxonomy, params, conditions, cookies, prevSlugs, relatedArticleQuery, relatedArticle;
375
437
 
376
438
  return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
377
439
  while (1) {
378
440
  switch (_context.prev = _context.next) {
379
441
  case 0:
380
- _article$url = article.url;
442
+ taxonomyMapping = article.taxonomyMapping, _article$url = article.url;
381
443
  _article$url = _article$url === undefined ? {
382
444
  current: null
383
445
  } : _article$url;
384
- url = _article$url.current, documentGroupMapping = article.documentGroupMapping, issueGroup = article.issueGroup;
385
- content_placement = article.content_placement;
386
- references = [];
387
-
446
+ url = _article$url.current, content_placement = article.content_placement;
447
+ taxonomy = [];
448
+ //404 articles were throwing server error
388
449
 
389
- content_placement = content_placement && content_placement.length > 0 && content_placement.filter(function (_ref2) {
390
- var identifier = _ref2.identifier;
391
- return identifier !== 'news';
392
- });
393
- if (content_placement && content_placement.length > 0) {
450
+ if (content_placement) {
394
451
  content_placement.forEach(function (_ref3) {
395
452
  var path = _ref3.path,
396
453
  _id = _ref3._id;
@@ -402,38 +459,27 @@ var getRelatedArticle = function () {
402
459
  if (prev_url_to_check.includes('?')) {
403
460
  prev_url_to_check = prev_url_to_check.split('?')[0];
404
461
  }
405
- if (prev_url_to_check.endsWith(path) && _id) references.push(_id);
462
+ if (prev_url_to_check.endsWith(path) && _id) taxonomy.push(_id);
406
463
  });
407
- if (references.length === 0) {
408
- content_placement.forEach(function (_ref4) {
409
- var _id = _ref4._id;
410
-
411
- if (_id) references.push(_id);
412
- });
413
- }
414
464
  }
415
465
 
416
- if (documentGroupMapping && documentGroupMapping.length > 0) {
417
- documentGroupMapping.forEach(function (_ref5) {
418
- var _id = _ref5._id;
466
+ //404 articles were throwing server error
467
+ if (taxonomy.length === 0 && taxonomyMapping) {
468
+ taxonomyMapping.forEach(function (_ref4) {
469
+ var _ref = _ref4._ref;
419
470
 
420
- if (_id) references.push(_id);
471
+ if (_ref) {
472
+ taxonomy.push(_ref);
473
+ }
421
474
  });
422
475
  }
423
476
 
424
- if (issueGroup && issueGroup._ref) {
425
- references.push(issueGroup._ref);
426
- }
427
-
428
- params = { url: url, index: articleCount };
429
- articles = null;
430
-
431
- if (!(references && references.length > 0)) {
432
- _context.next = 26;
433
- break;
434
- }
435
-
436
- filters = '';
477
+ params = {
478
+ url: url,
479
+ taxonomy: taxonomy,
480
+ index: articleCount
481
+ };
482
+ conditions = '';
437
483
 
438
484
  if (ctx && url) {
439
485
  cookies = dist_3(ctx);
@@ -441,54 +487,27 @@ var getRelatedArticle = function () {
441
487
 
442
488
  if (!!prevSlugs) {
443
489
  dist_2(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
444
- filters = '&& !(url.current in [' + prevSlugs + '])';
490
+ conditions = '&& !(url.current in [' + prevSlugs + '])';
445
491
  } else dist_2(ctx, 'prevSlugs', '"' + url + '"', {});
446
492
  }
493
+ relatedArticleQuery = getQuery('related', conditions, '', articleCount);
494
+ _context.next = 12;
495
+ return client.fetch(relatedArticleQuery, params);
496
+
497
+ case 12:
498
+ relatedArticle = _context.sent;
499
+ return _context.abrupt('return', relatedArticle);
447
500
 
448
- referenceFilter = references.reduce(function (acc, item, index, array) {
449
- if (array.length === 1) {
450
- acc = acc + ' references("' + item + '") ';
451
- } else if (index === 0) {
452
- acc = acc + ' (references("' + item + '") ||';
453
- } else if (index + 1 === array.length) {
454
- acc = acc + ' references("' + item + '")) ';
455
- } else {
456
- acc = acc + ' references("' + item + '") ||';
457
- }
458
- return acc;
459
- }, '&&');
460
-
461
-
462
- filters = filters + referenceFilter;
463
- query = getQuery('related', filters, '', articleCount).replace('&& taxonomyMapping[]._ref in $taxonomy', '');
464
- _context.prev = 17;
465
- _context.next = 20;
466
- return client.fetch(query, params);
467
-
468
- case 20:
469
- articles = _context.sent;
470
- _context.next = 26;
471
- break;
472
-
473
- case 23:
474
- _context.prev = 23;
475
- _context.t0 = _context['catch'](17);
476
-
477
- console.error(_context.t0);
478
-
479
- case 26:
480
- return _context.abrupt('return', articles);
481
-
482
- case 27:
501
+ case 14:
483
502
  case 'end':
484
503
  return _context.stop();
485
504
  }
486
505
  }
487
- }, _callee, _this, [[17, 23]]);
506
+ }, _callee, _this);
488
507
  }));
489
508
 
490
509
  return function getRelatedArticle() {
491
- return _ref.apply(this, arguments);
510
+ return _ref2.apply(this, arguments);
492
511
  };
493
512
  }();
494
513
 
@@ -16,18 +16,18 @@ 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-2d0a4911.js');
20
20
  require('prop-types');
21
21
  require('react-bootstrap/Row');
22
22
  require('react-bootstrap/Col');
23
- require('./moment-575fe24c.js');
23
+ require('./moment-66a6a284.js');
24
24
  require('next/router');
25
25
  require('./isSymbol-04666465.js');
26
26
  require('./debounce-eb287781.js');
27
27
  require('react-dom');
28
- require('./index-be0c82be.js');
28
+ require('./index-b5eb3ff8.js');
29
29
  require('./index-da796b8c.js');
30
- require('./main-a4cb15bb.js');
30
+ require('./main-b6c96c8d.js');
31
31
  require('./entities-310b46ee.js');
32
32
  require('./stringify-7c5aff47.js');
33
33
  require('./slicedToArray-8f385299.js');
@@ -36,14 +36,14 @@ require('./_set-species-f92c67c5.js');
36
36
  require('./Segment.js');
37
37
  require('./Beam.js');
38
38
  require('./AdSlot.js');
39
- require('./BlockContent-091a991f.js');
39
+ require('./BlockContent-88f69acd.js');
40
40
  require('./smoothscroll-95231a70.js');
41
41
  require('./GroupDeck.js');
42
42
  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-a5919bab.js');
46
+ var getSerializers = require('./index-c0bfab13.js');
47
47
  require('./util-f2c1b65b.js');
48
48
  require('./brightcove-react-player-loader.es-156bd4d6.js');
49
49
  require('react-bootstrap/Pagination');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var toConsumableArray = require('./toConsumableArray-9a3476fe.js');
4
- var _extends$1 = require('./extends-60837c34.js');
4
+ var _extends = require('./extends-60837c34.js');
5
5
 
6
6
  var getContentPlacementUrl = function getContentPlacementUrl(cp) {
7
7
  var cp_url = '';
@@ -133,7 +133,7 @@ var getTargeting = function getTargeting(props) {
133
133
  }
134
134
 
135
135
  if (props.cache && props.cache.hyperTargeting) {
136
- targeting = _extends$1._extends({}, targeting, { campaign_id: props.cache.hyperTargeting });
136
+ targeting = _extends._extends({}, targeting, { campaign_id: props.cache.hyperTargeting });
137
137
  }
138
138
 
139
139
  if (position && position.length) {
@@ -8,7 +8,7 @@ require('./toConsumableArray-9a3476fe.js');
8
8
  require('./core.get-iterator-method-f62321d4.js');
9
9
  require('./_object-pie-68c5bcbc.js');
10
10
  require('./extends-60837c34.js');
11
- var getTargeting = require('./getTargeting-9af0ef69.js');
11
+ var getTargeting = require('./getTargeting-fee8c429.js');
12
12
 
13
13
 
14
14