@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
@@ -30,9 +30,18 @@ function parseString(setCookieValue, options) {
30
30
  ? Object.assign({}, defaultParseOptions, options)
31
31
  : defaultParseOptions;
32
32
 
33
+ try {
34
+ value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value
35
+ } catch (e) {
36
+ console.error(
37
+ `set-cookie-parser encountered an error while decoding a cookie with value '${value}'. Set options.decodeValues to false to disable this feature.`,
38
+ e
39
+ );
40
+ }
41
+
33
42
  var cookie = {
34
43
  name: name, // grab everything before the first =
35
- value: options.decodeValues ? decodeURIComponent(value) : value, // decode cookie value
44
+ value: value,
36
45
  };
37
46
 
38
47
  parts.forEach(function (part) {
@@ -203,7 +212,7 @@ setCookie.parse = parse_1;
203
212
  setCookie.parseString = parseString_1;
204
213
  setCookie.splitCookiesString = splitCookiesString_1;
205
214
 
206
- var dist = createCommonjsModule(function (module, exports) {
215
+ var utils = createCommonjsModule(function (module, exports) {
207
216
  var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
208
217
  __assign = Object.assign || function(t) {
209
218
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -216,10 +225,33 @@ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
216
225
  return __assign.apply(this, arguments);
217
226
  };
218
227
  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'; };
228
+ exports.areCookiesEqual = exports.hasSameProperties = exports.createCookie = exports.isBrowser = void 0;
229
+ /**
230
+ * Tells whether we are in a browser or server.
231
+ */
232
+ function isBrowser() {
233
+ return typeof window !== 'undefined';
234
+ }
235
+ exports.isBrowser = isBrowser;
236
+ /**
237
+ * Create an instance of the Cookie interface
238
+ */
239
+ function createCookie(name, value, options) {
240
+ var sameSite = options.sameSite;
241
+ if (sameSite === true) {
242
+ sameSite = 'strict';
243
+ }
244
+ if (sameSite === undefined || sameSite === false) {
245
+ sameSite = 'lax';
246
+ }
247
+ var cookieToSet = __assign(__assign({}, options), { sameSite: sameSite });
248
+ delete cookieToSet.encode;
249
+ return __assign({ name: name, value: value }, cookieToSet);
250
+ }
251
+ exports.createCookie = createCookie;
252
+ /**
253
+ * Tells whether given objects have the same properties.
254
+ */
223
255
  function hasSameProperties(a, b) {
224
256
  var aProps = Object.getOwnPropertyNames(a);
225
257
  var bProps = Object.getOwnPropertyNames(b);
@@ -234,8 +266,9 @@ function hasSameProperties(a, b) {
234
266
  }
235
267
  return true;
236
268
  }
269
+ exports.hasSameProperties = hasSameProperties;
237
270
  /**
238
- * Compare the cookie and return true if the cookies has equivalent
271
+ * Compare the cookie and return true if the cookies have equivalent
239
272
  * options and the cookies would be overwritten in the browser storage.
240
273
  *
241
274
  * @param a first Cookie for comparison
@@ -248,71 +281,109 @@ function areCookiesEqual(a, b) {
248
281
  }
249
282
  return (hasSameProperties(__assign(__assign({}, a), { sameSite: undefined }), __assign(__assign({}, b), { sameSite: undefined })) && sameSiteSame);
250
283
  }
284
+ exports.areCookiesEqual = areCookiesEqual;
285
+ /* Functions */
286
+
287
+ });
288
+
289
+ unwrapExports(utils);
290
+ var utils_1 = utils.areCookiesEqual;
291
+ var utils_2 = utils.hasSameProperties;
292
+ var utils_3 = utils.createCookie;
293
+ var utils_4 = utils.isBrowser;
294
+
295
+ var dist = createCommonjsModule(function (module, exports) {
296
+ var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
297
+ __assign = Object.assign || function(t) {
298
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
299
+ s = arguments[i];
300
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
301
+ t[p] = s[p];
302
+ }
303
+ return t;
304
+ };
305
+ return __assign.apply(this, arguments);
306
+ };
307
+ Object.defineProperty(exports, "__esModule", { value: true });
308
+ exports.destroyCookie = exports.setCookie = exports.parseCookies = void 0;
309
+
310
+
311
+
251
312
  /**
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
313
  * Parses cookies.
273
314
  *
274
- * @param ctx
275
- * @param options
315
+ * @param ctx NextJS page or API context, express context, null or undefined.
316
+ * @param options Options that we pass down to `cookie` library.
276
317
  */
277
318
  function parseCookies(ctx, options) {
278
- if (ctx && ctx.req && ctx.req.headers && ctx.req.headers.cookie) {
319
+ var _a, _b;
320
+ 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) {
279
321
  return cookie.parse(ctx.req.headers.cookie, options);
280
322
  }
281
- if (isBrowser()) {
323
+ if (utils.isBrowser()) {
282
324
  return cookie.parse(document.cookie, options);
283
325
  }
284
326
  return {};
285
327
  }
286
328
  exports.parseCookies = parseCookies;
287
329
  /**
288
- *
289
330
  * Sets a cookie.
290
331
  *
291
- * @param ctx
292
- * @param name
293
- * @param value
294
- * @param options
332
+ * @param ctx NextJS page or API context, express context, null or undefined.
333
+ * @param name The name of your cookie.
334
+ * @param value The value of your cookie.
335
+ * @param options Options that we pass down to `cookie` library.
295
336
  */
296
337
  function setCookie$1(ctx, name, value, options) {
297
- if (ctx && ctx.res && ctx.res.getHeader && ctx.res.setHeader) {
338
+ var _a, _b;
339
+ if (options === void 0) { options = {}; }
340
+ // SSR
341
+ if (((_a = ctx === null || ctx === void 0 ? void 0 : ctx.res) === null || _a === void 0 ? void 0 : _a.getHeader) && ctx.res.setHeader) {
342
+ // Check if response has finished and warn about it.
343
+ if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.res) === null || _b === void 0 ? void 0 : _b.finished) {
344
+ console.warn("Not setting \"" + name + "\" cookie. Response has finished.");
345
+ console.warn("You should set cookie before res.send()");
346
+ return {};
347
+ }
348
+ /**
349
+ * Load existing cookies from the header and parse them.
350
+ */
298
351
  var cookies = ctx.res.getHeader('Set-Cookie') || [];
299
352
  if (typeof cookies === 'string')
300
353
  cookies = [cookies];
301
354
  if (typeof cookies === 'number')
302
355
  cookies = [];
303
- var parsedCookies = setCookie.parse(cookies);
356
+ /**
357
+ * Parse cookies but ignore values - we've already encoded
358
+ * them in the previous call.
359
+ */
360
+ var parsedCookies = setCookie.parse(cookies, {
361
+ decodeValues: false,
362
+ });
363
+ /**
364
+ * We create the new cookie and make sure that none of
365
+ * the existing cookies match it.
366
+ */
367
+ var newCookie_1 = utils.createCookie(name, value, options);
304
368
  var cookiesToSet_1 = [];
305
369
  parsedCookies.forEach(function (parsedCookie) {
306
- if (!areCookiesEqual(parsedCookie, createCookie(name, value, options))) {
307
- cookiesToSet_1.push(cookie.serialize(parsedCookie.name, parsedCookie.value, __assign({}, parsedCookie)));
370
+ if (!utils.areCookiesEqual(parsedCookie, newCookie_1)) {
371
+ /**
372
+ * We serialize the cookie back to the original format
373
+ * if it isn't the same as the new one.
374
+ */
375
+ var serializedCookie = cookie.serialize(parsedCookie.name, parsedCookie.value, __assign({
376
+ // we prevent reencoding by default, but you might override it
377
+ encode: function (val) { return val; } }, parsedCookie));
378
+ cookiesToSet_1.push(serializedCookie);
308
379
  }
309
380
  });
310
381
  cookiesToSet_1.push(cookie.serialize(name, value, options));
311
- if (!ctx.res.finished) {
312
- ctx.res.setHeader('Set-Cookie', cookiesToSet_1);
313
- }
382
+ // Update the header.
383
+ ctx.res.setHeader('Set-Cookie', cookiesToSet_1);
314
384
  }
315
- if (isBrowser()) {
385
+ // Browser
386
+ if (utils.isBrowser()) {
316
387
  if (options && options.httpOnly) {
317
388
  throw new Error('Can not set a httpOnly cookie in the browser.');
318
389
  }
@@ -322,30 +393,21 @@ function setCookie$1(ctx, name, value, options) {
322
393
  }
323
394
  exports.setCookie = setCookie$1;
324
395
  /**
325
- *
326
396
  * Destroys a cookie with a particular name.
327
397
  *
328
- * @param ctx
329
- * @param name
330
- * @param options
398
+ * @param ctx NextJS page or API context, express context, null or undefined.
399
+ * @param name Cookie name.
400
+ * @param options Options that we pass down to `cookie` library.
331
401
  */
332
402
  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 {};
403
+ /**
404
+ * We forward the request destroy to setCookie function
405
+ * as it is the same function with modified maxAge value.
406
+ */
407
+ return setCookie$1(ctx, name, '', __assign(__assign({}, (options || {})), { maxAge: -1 }));
347
408
  }
348
409
  exports.destroyCookie = destroyCookie;
410
+ /* Utility Exports */
349
411
  exports.default = {
350
412
  set: setCookie$1,
351
413
  get: parseCookies,
@@ -362,33 +424,28 @@ var dist_3 = dist.parseCookies;
362
424
  var _this = undefined;
363
425
 
364
426
  var getRelatedArticle = function () {
365
- var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
427
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
366
428
  var ctx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
367
429
  var client = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
368
430
  var article = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
369
431
  var prevUrl = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
370
432
  var articleCount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
371
433
 
372
- var _article$url, url, documentGroupMapping, issueGroup, content_placement, references, params, articles, filters, cookies, prevSlugs, referenceFilter, query;
434
+ var taxonomyMapping, _article$url, url, content_placement, taxonomy, params, conditions, cookies, prevSlugs, relatedArticleQuery, relatedArticle;
373
435
 
374
436
  return regenerator.wrap(function _callee$(_context) {
375
437
  while (1) {
376
438
  switch (_context.prev = _context.next) {
377
439
  case 0:
378
- _article$url = article.url;
440
+ taxonomyMapping = article.taxonomyMapping, _article$url = article.url;
379
441
  _article$url = _article$url === undefined ? {
380
442
  current: null
381
443
  } : _article$url;
382
- url = _article$url.current, documentGroupMapping = article.documentGroupMapping, issueGroup = article.issueGroup;
383
- content_placement = article.content_placement;
384
- references = [];
385
-
444
+ url = _article$url.current, content_placement = article.content_placement;
445
+ taxonomy = [];
446
+ //404 articles were throwing server error
386
447
 
387
- content_placement = content_placement && content_placement.length > 0 && content_placement.filter(function (_ref2) {
388
- var identifier = _ref2.identifier;
389
- return identifier !== 'news';
390
- });
391
- if (content_placement && content_placement.length > 0) {
448
+ if (content_placement) {
392
449
  content_placement.forEach(function (_ref3) {
393
450
  var path = _ref3.path,
394
451
  _id = _ref3._id;
@@ -400,38 +457,27 @@ var getRelatedArticle = function () {
400
457
  if (prev_url_to_check.includes('?')) {
401
458
  prev_url_to_check = prev_url_to_check.split('?')[0];
402
459
  }
403
- if (prev_url_to_check.endsWith(path) && _id) references.push(_id);
460
+ if (prev_url_to_check.endsWith(path) && _id) taxonomy.push(_id);
404
461
  });
405
- if (references.length === 0) {
406
- content_placement.forEach(function (_ref4) {
407
- var _id = _ref4._id;
408
-
409
- if (_id) references.push(_id);
410
- });
411
- }
412
462
  }
413
463
 
414
- if (documentGroupMapping && documentGroupMapping.length > 0) {
415
- documentGroupMapping.forEach(function (_ref5) {
416
- var _id = _ref5._id;
464
+ //404 articles were throwing server error
465
+ if (taxonomy.length === 0 && taxonomyMapping) {
466
+ taxonomyMapping.forEach(function (_ref4) {
467
+ var _ref = _ref4._ref;
417
468
 
418
- if (_id) references.push(_id);
469
+ if (_ref) {
470
+ taxonomy.push(_ref);
471
+ }
419
472
  });
420
473
  }
421
474
 
422
- if (issueGroup && issueGroup._ref) {
423
- references.push(issueGroup._ref);
424
- }
425
-
426
- params = { url: url, index: articleCount };
427
- articles = null;
428
-
429
- if (!(references && references.length > 0)) {
430
- _context.next = 26;
431
- break;
432
- }
433
-
434
- filters = '';
475
+ params = {
476
+ url: url,
477
+ taxonomy: taxonomy,
478
+ index: articleCount
479
+ };
480
+ conditions = '';
435
481
 
436
482
  if (ctx && url) {
437
483
  cookies = dist_3(ctx);
@@ -439,54 +485,27 @@ var getRelatedArticle = function () {
439
485
 
440
486
  if (!!prevSlugs) {
441
487
  dist_2(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
442
- filters = '&& !(url.current in [' + prevSlugs + '])';
488
+ conditions = '&& !(url.current in [' + prevSlugs + '])';
443
489
  } else dist_2(ctx, 'prevSlugs', '"' + url + '"', {});
444
490
  }
491
+ relatedArticleQuery = getQuery('related', conditions, '', articleCount);
492
+ _context.next = 12;
493
+ return client.fetch(relatedArticleQuery, params);
494
+
495
+ case 12:
496
+ relatedArticle = _context.sent;
497
+ return _context.abrupt('return', relatedArticle);
445
498
 
446
- referenceFilter = references.reduce(function (acc, item, index, array) {
447
- if (array.length === 1) {
448
- acc = acc + ' references("' + item + '") ';
449
- } else if (index === 0) {
450
- acc = acc + ' (references("' + item + '") ||';
451
- } else if (index + 1 === array.length) {
452
- acc = acc + ' references("' + item + '")) ';
453
- } else {
454
- acc = acc + ' references("' + item + '") ||';
455
- }
456
- return acc;
457
- }, '&&');
458
-
459
-
460
- filters = filters + referenceFilter;
461
- query = getQuery('related', filters, '', articleCount).replace('&& taxonomyMapping[]._ref in $taxonomy', '');
462
- _context.prev = 17;
463
- _context.next = 20;
464
- return client.fetch(query, params);
465
-
466
- case 20:
467
- articles = _context.sent;
468
- _context.next = 26;
469
- break;
470
-
471
- case 23:
472
- _context.prev = 23;
473
- _context.t0 = _context['catch'](17);
474
-
475
- console.error(_context.t0);
476
-
477
- case 26:
478
- return _context.abrupt('return', articles);
479
-
480
- case 27:
499
+ case 14:
481
500
  case 'end':
482
501
  return _context.stop();
483
502
  }
484
503
  }
485
- }, _callee, _this, [[17, 23]]);
504
+ }, _callee, _this);
486
505
  }));
487
506
 
488
507
  return function getRelatedArticle() {
489
- return _ref.apply(this, arguments);
508
+ return _ref2.apply(this, arguments);
490
509
  };
491
510
  }();
492
511
 
@@ -14,18 +14,18 @@ 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-93ec3c59.js';
18
18
  import 'prop-types';
19
19
  import 'react-bootstrap/Row';
20
20
  import 'react-bootstrap/Col';
21
- import './moment-e2f9b20c.js';
21
+ import './moment-12415288.js';
22
22
  import 'next/router';
23
23
  import './isSymbol-807e927e.js';
24
24
  import './debounce-1a993acf.js';
25
25
  import 'react-dom';
26
- import './index-73819142.js';
26
+ import './index-51a80699.js';
27
27
  import './index-5f9f807a.js';
28
- import './main-5d1e4bd3.js';
28
+ import './main-0465b2a0.js';
29
29
  import './entities-7cc3bf45.js';
30
30
  import './stringify-008c8802.js';
31
31
  import './slicedToArray-7021e5df.js';
@@ -34,14 +34,14 @@ import './_set-species-cede29f8.js';
34
34
  import './Segment.js';
35
35
  import './Beam.js';
36
36
  import './AdSlot.js';
37
- import './BlockContent-e9b4ddcf.js';
37
+ import './BlockContent-a614acdf.js';
38
38
  import './smoothscroll-4b699764.js';
39
39
  import './GroupDeck.js';
40
40
  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-c376cd8e.js';
44
+ export { g as default } from './index-754010eb.js';
45
45
  import './util-7700fc59.js';
46
46
  import './brightcove-react-player-loader.es-83f53e4e.js';
47
47
  import 'react-bootstrap/Pagination';
@@ -58,35 +58,35 @@ function parseSource(source) {
58
58
  if (typeof source === 'string' && isUrl(source)) {
59
59
  // Someone passed an existing image url?
60
60
  image = {
61
- asset: { _ref: urlToId(source) }
61
+ asset: { _ref: urlToId(source) },
62
62
  };
63
63
  }
64
64
  else if (typeof source === 'string') {
65
65
  // Just an asset id
66
66
  image = {
67
- asset: { _ref: source }
67
+ asset: { _ref: source },
68
68
  };
69
69
  }
70
70
  else if (isRef(source)) {
71
71
  // We just got passed an asset directly
72
72
  image = {
73
- asset: source
73
+ asset: source,
74
74
  };
75
75
  }
76
76
  else if (isAsset(source)) {
77
77
  // If we were passed an image asset document
78
78
  image = {
79
79
  asset: {
80
- _ref: source._id || ''
81
- }
80
+ _ref: source._id || '',
81
+ },
82
82
  };
83
83
  }
84
84
  else if (isAssetStub(source)) {
85
85
  // If we were passed a partial asset (`url`, but no `_id`)
86
86
  image = {
87
87
  asset: {
88
- _ref: urlToId(source.asset.url)
89
- }
88
+ _ref: urlToId(source.asset.url),
89
+ },
90
90
  };
91
91
  }
92
92
  else if (typeof source.asset === 'object') {
@@ -127,7 +127,7 @@ function applyDefaults(image) {
127
127
  left: 0,
128
128
  top: 0,
129
129
  bottom: 0,
130
- right: 0
130
+ right: 0,
131
131
  };
132
132
  }
133
133
  if (!result.hotspot) {
@@ -135,7 +135,7 @@ function applyDefaults(image) {
135
135
  x: 0.5,
136
136
  y: 0.5,
137
137
  height: 1.0,
138
- width: 1.0
138
+ width: 1.0,
139
139
  };
140
140
  }
141
141
  return result;
@@ -182,7 +182,7 @@ exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
182
182
  ['crop', 'crop'],
183
183
  ['saturation', 'sat'],
184
184
  ['auto', 'auto'],
185
- ['dpr', 'dpr']
185
+ ['dpr', 'dpr'],
186
186
  ];
187
187
  function urlForImage(options) {
188
188
  var spec = __assign({}, (options || {}));
@@ -201,7 +201,7 @@ function urlForImage(options) {
201
201
  left: cropLeft,
202
202
  top: cropTop,
203
203
  width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
204
- height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
204
+ height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop),
205
205
  };
206
206
  // Compute hot spot rect in terms of pixel coordinates
207
207
  var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
@@ -212,7 +212,7 @@ function urlForImage(options) {
212
212
  left: hotSpotCenterX - hotSpotHorizontalRadius,
213
213
  top: hotSpotCenterY - hotSpotVerticalRadius,
214
214
  right: hotSpotCenterX + hotSpotHorizontalRadius,
215
- bottom: hotSpotCenterY + hotSpotVerticalRadius
215
+ bottom: hotSpotCenterY + hotSpotVerticalRadius,
216
216
  };
217
217
  // If irrelevant, or if we are requested to: don't perform crop/fit based on
218
218
  // the crop/hotspot.
@@ -294,7 +294,7 @@ function fit(source, spec) {
294
294
  left: Math.round(left),
295
295
  top: Math.round(top_2),
296
296
  width: Math.round(width),
297
- height: Math.round(height)
297
+ height: Math.round(height),
298
298
  };
299
299
  }
300
300
  else {
@@ -316,13 +316,13 @@ function fit(source, spec) {
316
316
  left: Math.max(0, Math.floor(left)),
317
317
  top: Math.max(0, Math.floor(top_3)),
318
318
  width: Math.round(width),
319
- height: Math.round(height)
319
+ height: Math.round(height),
320
320
  };
321
321
  }
322
322
  return {
323
323
  width: imgWidth,
324
324
  height: imgHeight,
325
- rect: cropRect
325
+ rect: cropRect,
326
326
  };
327
327
  }
328
328
 
@@ -375,11 +375,12 @@ function urlBuilder(options) {
375
375
  var client = options;
376
376
  if (isSanityClient(client)) {
377
377
  // Inherit config from client
378
- var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
378
+ var _a = client.clientConfig, apiUrl = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
379
+ var apiHost = apiUrl || 'https://api.sanity.io';
379
380
  return new ImageUrlBuilder(null, {
380
381
  baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
381
382
  projectId: projectId,
382
- dataset: dataset
383
+ dataset: dataset,
383
384
  });
384
385
  }
385
386
  // Or just accept the options as given
@@ -392,7 +393,7 @@ var ImageUrlBuilder = /** @class */ (function () {
392
393
  ? __assign(__assign({}, (parent.options || {})), (options || {})) : __assign({}, (options || {})); // Copy options
393
394
  }
394
395
  ImageUrlBuilder.prototype.withOptions = function (options) {
395
- var baseUrl = options.baseUrl || '';
396
+ var baseUrl = options.baseUrl || this.options.baseUrl;
396
397
  var newOptions = { baseUrl: baseUrl };
397
398
  for (var key in options) {
398
399
  if (options.hasOwnProperty(key)) {
@@ -520,7 +521,7 @@ var ImageUrlBuilder = /** @class */ (function () {
520
521
  ImageUrlBuilder.prototype.url = function () {
521
522
  return urlForImage_1$1.default(this.options);
522
523
  };
523
- // Synonym for url()
524
+ // Alias for url()
524
525
  ImageUrlBuilder.prototype.toString = function () {
525
526
  return this.url();
526
527
  };