@mjhls/mjh-framework 1.0.664-beta.0 → 1.0.664

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 (149) hide show
  1. package/dist/cjs/AD.js +1 -1
  2. package/dist/cjs/AD300x250.js +3 -3
  3. package/dist/cjs/AD300x250x600.js +3 -3
  4. package/dist/cjs/AD728x90.js +4 -4
  5. package/dist/cjs/ADFloatingFooter.js +2 -2
  6. package/dist/cjs/ADGutter.js +2 -2
  7. package/dist/cjs/ADSkyscraper.js +2 -2
  8. package/dist/cjs/ADSponsoredResources.js +2 -2
  9. package/dist/cjs/ADWebcast.js +2 -2
  10. package/dist/cjs/ADWelcome.js +2 -2
  11. package/dist/cjs/AdSlot.js +2 -2
  12. package/dist/cjs/AdSlotsProvider.js +1 -1
  13. package/dist/cjs/ArticleCarousel.js +3 -3
  14. package/dist/cjs/ArticleSeriesListing.js +4 -4
  15. package/dist/cjs/Auth.js +507 -256
  16. package/dist/cjs/{BlockContent-091a991f.js → BlockContent-88f69acd.js} +1 -1
  17. package/dist/cjs/CMEDeck.js +5 -5
  18. package/dist/cjs/Column3.js +4 -4
  19. package/dist/cjs/ConferenceArticleCard.js +2 -2
  20. package/dist/cjs/DeckContent.js +7 -7
  21. package/dist/cjs/DeckQueue.js +6 -6
  22. package/dist/cjs/{Dfp-f6a18ed2.js → Dfp-b2bc3b97.js} +1 -1
  23. package/dist/cjs/EventsDeck.js +5 -5
  24. package/dist/cjs/ExternalResources.js +7 -7
  25. package/dist/cjs/Feature.js +3 -3
  26. package/dist/cjs/ForbesHero.js +2 -2
  27. package/dist/cjs/GridContent.js +10 -10
  28. package/dist/cjs/GridHero.js +2 -2
  29. package/dist/cjs/GroupDeck.js +1 -1
  30. package/dist/cjs/HamMagazine.js +4 -4
  31. package/dist/cjs/Hero.js +1 -1
  32. package/dist/cjs/HorizontalHero.js +2 -2
  33. package/dist/cjs/IssueContentDeck.js +2 -2
  34. package/dist/cjs/IssueDeck.js +2 -2
  35. package/dist/cjs/IssueLanding.js +7 -7
  36. package/dist/cjs/LeftNav.js +2 -2
  37. package/dist/cjs/MasterDeck.js +8 -8
  38. package/dist/cjs/NavMagazine.js +4 -4
  39. package/dist/cjs/NavNative.js +3 -3
  40. package/dist/cjs/OncliveHero.js +2 -2
  41. package/dist/cjs/OncliveLargeHero.js +2 -2
  42. package/dist/cjs/PartnerDetailListing.js +15 -1212
  43. package/dist/cjs/PublicationDeck.js +1 -1
  44. package/dist/cjs/QueueDeckExpanded.js +9 -9
  45. package/dist/cjs/RecentNews.js +2 -2
  46. package/dist/cjs/RelatedContent.js +2 -2
  47. package/dist/cjs/{SocialSearchComponent-81a50f81.js → SocialSearchComponent-962b1344.js} +5 -5
  48. package/dist/cjs/TaxonomyCard.js +2 -2
  49. package/dist/cjs/TemplateNormal.js +3 -3
  50. package/dist/cjs/ThumbnailCard.js +1 -1
  51. package/dist/cjs/Ustream.js +2 -2
  52. package/dist/cjs/VerticalHero.js +2 -2
  53. package/dist/cjs/VideoSeriesCard.js +2 -2
  54. package/dist/cjs/VideoSeriesListing.js +3 -3
  55. package/dist/cjs/View.js +70 -227
  56. package/dist/cjs/YahooHero.js +2 -2
  57. package/dist/cjs/YoutubeGroup.js +1 -1
  58. package/dist/cjs/getQuery.js +2 -2
  59. package/dist/cjs/getRelatedArticle.js +90 -5
  60. package/dist/cjs/getSerializers.js +6 -6
  61. package/dist/cjs/{getTargeting-9af0ef69.js → getTargeting-fee8c429.js} +2 -2
  62. package/dist/cjs/getTargeting.js +1 -1
  63. package/dist/cjs/{index-fa8ed292.js → index-2d0a4911.js} +34 -27
  64. package/dist/cjs/{index-3294d3bc.js → index-5be2866f.js} +1 -1
  65. package/dist/cjs/{index-bc3e2d5c.js → index-6f1ee5f0.js} +462 -450
  66. package/dist/cjs/{index-be0c82be.js → index-b5eb3ff8.js} +20 -19
  67. package/dist/cjs/{index.es-9110add6.js → index.es-ab3f2690.js} +3 -1
  68. package/dist/cjs/index.js +16 -15
  69. package/dist/cjs/{main-a4cb15bb.js → main-b6c96c8d.js} +67 -36
  70. package/dist/cjs/{moment-575fe24c.js → moment-66a6a284.js} +1 -1
  71. package/dist/cjs/urlFor.js +1 -1
  72. package/dist/esm/AD.js +1 -1
  73. package/dist/esm/AD300x250.js +3 -3
  74. package/dist/esm/AD300x250x600.js +3 -3
  75. package/dist/esm/AD728x90.js +4 -4
  76. package/dist/esm/ADFloatingFooter.js +2 -2
  77. package/dist/esm/ADGutter.js +2 -2
  78. package/dist/esm/ADSkyscraper.js +2 -2
  79. package/dist/esm/ADSponsoredResources.js +2 -2
  80. package/dist/esm/ADWebcast.js +2 -2
  81. package/dist/esm/ADWelcome.js +2 -2
  82. package/dist/esm/AdSlot.js +2 -2
  83. package/dist/esm/AdSlotsProvider.js +1 -1
  84. package/dist/esm/ArticleCarousel.js +1 -1
  85. package/dist/esm/ArticleSeriesListing.js +4 -4
  86. package/dist/esm/Auth.js +499 -248
  87. package/dist/esm/{BlockContent-e9b4ddcf.js → BlockContent-a614acdf.js} +1 -1
  88. package/dist/esm/CMEDeck.js +5 -5
  89. package/dist/esm/Column3.js +4 -4
  90. package/dist/esm/ConferenceArticleCard.js +2 -2
  91. package/dist/esm/DeckContent.js +7 -7
  92. package/dist/esm/DeckQueue.js +6 -6
  93. package/dist/esm/{Dfp-96b49def.js → Dfp-8a8fca18.js} +1 -1
  94. package/dist/esm/EventsDeck.js +5 -5
  95. package/dist/esm/ExternalResources.js +7 -7
  96. package/dist/esm/Feature.js +3 -3
  97. package/dist/esm/ForbesHero.js +2 -2
  98. package/dist/esm/GridContent.js +10 -10
  99. package/dist/esm/GridHero.js +2 -2
  100. package/dist/esm/GroupDeck.js +1 -1
  101. package/dist/esm/HamMagazine.js +4 -4
  102. package/dist/esm/Hero.js +1 -1
  103. package/dist/esm/HorizontalHero.js +2 -2
  104. package/dist/esm/IssueContentDeck.js +2 -2
  105. package/dist/esm/IssueDeck.js +2 -2
  106. package/dist/esm/IssueLanding.js +7 -7
  107. package/dist/esm/LeftNav.js +2 -2
  108. package/dist/esm/MasterDeck.js +8 -8
  109. package/dist/esm/NavMagazine.js +4 -4
  110. package/dist/esm/NavNative.js +3 -3
  111. package/dist/esm/OncliveHero.js +2 -2
  112. package/dist/esm/OncliveLargeHero.js +2 -2
  113. package/dist/esm/PartnerDetailListing.js +13 -1209
  114. package/dist/esm/PublicationDeck.js +1 -1
  115. package/dist/esm/QueueDeckExpanded.js +9 -9
  116. package/dist/esm/RecentNews.js +2 -2
  117. package/dist/esm/RelatedContent.js +2 -2
  118. package/dist/esm/{SocialSearchComponent-55960ec4.js → SocialSearchComponent-75527dfe.js} +5 -5
  119. package/dist/esm/TaxonomyCard.js +2 -2
  120. package/dist/esm/TemplateNormal.js +3 -3
  121. package/dist/esm/ThumbnailCard.js +1 -1
  122. package/dist/esm/Ustream.js +2 -2
  123. package/dist/esm/VerticalHero.js +2 -2
  124. package/dist/esm/VideoSeriesCard.js +2 -2
  125. package/dist/esm/VideoSeriesListing.js +3 -3
  126. package/dist/esm/View.js +41 -198
  127. package/dist/esm/YahooHero.js +2 -2
  128. package/dist/esm/YoutubeGroup.js +1 -1
  129. package/dist/esm/getQuery.js +2 -2
  130. package/dist/esm/getRelatedArticle.js +93 -4
  131. package/dist/esm/getSerializers.js +6 -6
  132. package/dist/esm/{index-6d49c905.js → index-3a33f7d6.js} +462 -450
  133. package/dist/esm/{index-73819142.js → index-51a80699.js} +20 -19
  134. package/dist/esm/{index-0e45a0b2.js → index-93ec3c59.js} +34 -27
  135. package/dist/esm/{index-ef6d5dcf.js → index-d2f90501.js} +1 -1
  136. package/dist/esm/{index.es-29c1cef5.js → index.es-938a3a58.js} +3 -1
  137. package/dist/esm/index.js +14 -13
  138. package/dist/esm/{main-5d1e4bd3.js → main-0465b2a0.js} +65 -34
  139. package/dist/esm/{moment-e2f9b20c.js → moment-12415288.js} +1 -1
  140. package/dist/esm/urlFor.js +1 -1
  141. package/package.json +1 -1
  142. package/dist/cjs/getRelatedArticle-606b1d0b.js +0 -447
  143. package/dist/cjs/index-bd6c9f56.js +0 -211
  144. package/dist/esm/getRelatedArticle-80e67416.js +0 -443
  145. package/dist/esm/index-db3bb315.js +0 -207
  146. /package/dist/cjs/{ADInfeed-388ec28a.js → ADInfeed-9735aff2.js} +0 -0
  147. /package/dist/cjs/{ADlgInfeed-5548ff47.js → ADlgInfeed-6bd11848.js} +0 -0
  148. /package/dist/esm/{ADInfeed-eae0af19.js → ADInfeed-9140aa7d.js} +0 -0
  149. /package/dist/esm/{ADlgInfeed-2f4c7a7c.js → ADlgInfeed-7656ecd1.js} +0 -0
@@ -1,447 +0,0 @@
1
- 'use strict';
2
-
3
- var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
4
- var asyncToGenerator = require('./asyncToGenerator-533d476a.js');
5
- var index$4 = require('./index-bd6c9f56.js');
6
- var getQuery = require('./getQuery.js');
7
-
8
- var defaultParseOptions = {
9
- decodeValues: true,
10
- map: false,
11
- silent: false,
12
- };
13
-
14
- function isNonEmptyString(str) {
15
- return typeof str === "string" && !!str.trim();
16
- }
17
-
18
- function parseString(setCookieValue, options) {
19
- var parts = setCookieValue.split(";").filter(isNonEmptyString);
20
- var nameValue = parts.shift().split("=");
21
- var name = nameValue.shift();
22
- var value = nameValue.join("="); // everything after the first =, joined by a "=" if there was more than one part
23
-
24
- options = options
25
- ? Object.assign({}, defaultParseOptions, options)
26
- : defaultParseOptions;
27
-
28
- var cookie = {
29
- name: name, // grab everything before the first =
30
- value: options.decodeValues ? decodeURIComponent(value) : value, // decode cookie value
31
- };
32
-
33
- parts.forEach(function (part) {
34
- var sides = part.split("=");
35
- var key = sides.shift().trimLeft().toLowerCase();
36
- var value = sides.join("=");
37
- if (key === "expires") {
38
- cookie.expires = new Date(value);
39
- } else if (key === "max-age") {
40
- cookie.maxAge = parseInt(value, 10);
41
- } else if (key === "secure") {
42
- cookie.secure = true;
43
- } else if (key === "httponly") {
44
- cookie.httpOnly = true;
45
- } else if (key === "samesite") {
46
- cookie.sameSite = value;
47
- } else {
48
- cookie[key] = value;
49
- }
50
- });
51
-
52
- return cookie;
53
- }
54
-
55
- function parse(input, options) {
56
- options = options
57
- ? Object.assign({}, defaultParseOptions, options)
58
- : defaultParseOptions;
59
-
60
- if (!input) {
61
- if (!options.map) {
62
- return [];
63
- } else {
64
- return {};
65
- }
66
- }
67
-
68
- if (input.headers && input.headers["set-cookie"]) {
69
- // fast-path for node.js (which automatically normalizes header names to lower-case
70
- input = input.headers["set-cookie"];
71
- } else if (input.headers) {
72
- // slow-path for other environments - see #25
73
- var sch =
74
- input.headers[
75
- Object.keys(input.headers).find(function (key) {
76
- return key.toLowerCase() === "set-cookie";
77
- })
78
- ];
79
- // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
80
- if (!sch && input.headers.cookie && !options.silent) {
81
- console.warn(
82
- "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."
83
- );
84
- }
85
- input = sch;
86
- }
87
- if (!Array.isArray(input)) {
88
- input = [input];
89
- }
90
-
91
- options = options
92
- ? Object.assign({}, defaultParseOptions, options)
93
- : defaultParseOptions;
94
-
95
- if (!options.map) {
96
- return input.filter(isNonEmptyString).map(function (str) {
97
- return parseString(str, options);
98
- });
99
- } else {
100
- var cookies = {};
101
- return input.filter(isNonEmptyString).reduce(function (cookies, str) {
102
- var cookie = parseString(str, options);
103
- cookies[cookie.name] = cookie;
104
- return cookies;
105
- }, cookies);
106
- }
107
- }
108
-
109
- /*
110
- Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
111
- that are within a single set-cookie field-value, such as in the Expires portion.
112
-
113
- This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
114
- Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
115
- React Native's fetch does this for *every* header, including set-cookie.
116
-
117
- Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
118
- Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
119
- */
120
- function splitCookiesString(cookiesString) {
121
- if (Array.isArray(cookiesString)) {
122
- return cookiesString;
123
- }
124
- if (typeof cookiesString !== "string") {
125
- return [];
126
- }
127
-
128
- var cookiesStrings = [];
129
- var pos = 0;
130
- var start;
131
- var ch;
132
- var lastComma;
133
- var nextStart;
134
- var cookiesSeparatorFound;
135
-
136
- function skipWhitespace() {
137
- while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
138
- pos += 1;
139
- }
140
- return pos < cookiesString.length;
141
- }
142
-
143
- function notSpecialChar() {
144
- ch = cookiesString.charAt(pos);
145
-
146
- return ch !== "=" && ch !== ";" && ch !== ",";
147
- }
148
-
149
- while (pos < cookiesString.length) {
150
- start = pos;
151
- cookiesSeparatorFound = false;
152
-
153
- while (skipWhitespace()) {
154
- ch = cookiesString.charAt(pos);
155
- if (ch === ",") {
156
- // ',' is a cookie separator if we have later first '=', not ';' or ','
157
- lastComma = pos;
158
- pos += 1;
159
-
160
- skipWhitespace();
161
- nextStart = pos;
162
-
163
- while (pos < cookiesString.length && notSpecialChar()) {
164
- pos += 1;
165
- }
166
-
167
- // currently special character
168
- if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
169
- // we found cookies separator
170
- cookiesSeparatorFound = true;
171
- // pos is inside the next cookie, so back up and return it.
172
- pos = nextStart;
173
- cookiesStrings.push(cookiesString.substring(start, lastComma));
174
- start = pos;
175
- } else {
176
- // in param ',' or param separator ';',
177
- // we continue from that comma
178
- pos = lastComma + 1;
179
- }
180
- } else {
181
- pos += 1;
182
- }
183
- }
184
-
185
- if (!cookiesSeparatorFound || pos >= cookiesString.length) {
186
- cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
187
- }
188
- }
189
-
190
- return cookiesStrings;
191
- }
192
-
193
- var setCookie = parse;
194
- var parse_1 = parse;
195
- var parseString_1 = parseString;
196
- var splitCookiesString_1 = splitCookiesString;
197
- setCookie.parse = parse_1;
198
- setCookie.parseString = parseString_1;
199
- setCookie.splitCookiesString = splitCookiesString_1;
200
-
201
- var dist = _commonjsHelpers.createCommonjsModule(function (module, exports) {
202
- var __assign = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__assign) || function () {
203
- __assign = Object.assign || function(t) {
204
- for (var s, i = 1, n = arguments.length; i < n; i++) {
205
- s = arguments[i];
206
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
207
- t[p] = s[p];
208
- }
209
- return t;
210
- };
211
- return __assign.apply(this, arguments);
212
- };
213
- Object.defineProperty(exports, "__esModule", { value: true });
214
- exports.destroyCookie = exports.setCookie = exports.parseCookies = void 0;
215
-
216
-
217
- var isBrowser = function () { return typeof window !== 'undefined'; };
218
- function hasSameProperties(a, b) {
219
- var aProps = Object.getOwnPropertyNames(a);
220
- var bProps = Object.getOwnPropertyNames(b);
221
- if (aProps.length !== bProps.length) {
222
- return false;
223
- }
224
- for (var i = 0; i < aProps.length; i++) {
225
- var propName = aProps[i];
226
- if (a[propName] !== b[propName]) {
227
- return false;
228
- }
229
- }
230
- return true;
231
- }
232
- /**
233
- * Compare the cookie and return true if the cookies has equivalent
234
- * options and the cookies would be overwritten in the browser storage.
235
- *
236
- * @param a first Cookie for comparison
237
- * @param b second Cookie for comparison
238
- */
239
- function areCookiesEqual(a, b) {
240
- var sameSiteSame = a.sameSite === b.sameSite;
241
- if (typeof a.sameSite === 'string' && typeof b.sameSite === 'string') {
242
- sameSiteSame = a.sameSite.toLowerCase() === b.sameSite.toLowerCase();
243
- }
244
- return (hasSameProperties(__assign(__assign({}, a), { sameSite: undefined }), __assign(__assign({}, b), { sameSite: undefined })) && sameSiteSame);
245
- }
246
- /**
247
- * Create an instance of the Cookie interface
248
- *
249
- * @param name name of the Cookie
250
- * @param value value of the Cookie
251
- * @param options Cookie options
252
- */
253
- function createCookie(name, value, options) {
254
- var sameSite = options.sameSite;
255
- if (sameSite === true) {
256
- sameSite = 'strict';
257
- }
258
- if (sameSite === undefined || sameSite === false) {
259
- sameSite = 'lax';
260
- }
261
- var cookieToSet = __assign(__assign({}, options), { sameSite: sameSite });
262
- delete cookieToSet.encode;
263
- return __assign({ name: name, value: value }, cookieToSet);
264
- }
265
- /**
266
- *
267
- * Parses cookies.
268
- *
269
- * @param ctx
270
- * @param options
271
- */
272
- function parseCookies(ctx, options) {
273
- if (ctx && ctx.req && ctx.req.headers && ctx.req.headers.cookie) {
274
- return index$4.cookie.parse(ctx.req.headers.cookie, options);
275
- }
276
- if (isBrowser()) {
277
- return index$4.cookie.parse(document.cookie, options);
278
- }
279
- return {};
280
- }
281
- exports.parseCookies = parseCookies;
282
- /**
283
- *
284
- * Sets a cookie.
285
- *
286
- * @param ctx
287
- * @param name
288
- * @param value
289
- * @param options
290
- */
291
- function setCookie$1(ctx, name, value, options) {
292
- if (ctx && ctx.res && ctx.res.getHeader && ctx.res.setHeader) {
293
- var cookies = ctx.res.getHeader('Set-Cookie') || [];
294
- if (typeof cookies === 'string')
295
- cookies = [cookies];
296
- if (typeof cookies === 'number')
297
- cookies = [];
298
- var parsedCookies = setCookie.parse(cookies);
299
- var cookiesToSet_1 = [];
300
- parsedCookies.forEach(function (parsedCookie) {
301
- if (!areCookiesEqual(parsedCookie, createCookie(name, value, options))) {
302
- cookiesToSet_1.push(index$4.cookie.serialize(parsedCookie.name, parsedCookie.value, __assign({}, parsedCookie)));
303
- }
304
- });
305
- cookiesToSet_1.push(index$4.cookie.serialize(name, value, options));
306
- if (!ctx.res.finished) {
307
- ctx.res.setHeader('Set-Cookie', cookiesToSet_1);
308
- }
309
- }
310
- if (isBrowser()) {
311
- if (options && options.httpOnly) {
312
- throw new Error('Can not set a httpOnly cookie in the browser.');
313
- }
314
- document.cookie = index$4.cookie.serialize(name, value, options);
315
- }
316
- return {};
317
- }
318
- exports.setCookie = setCookie$1;
319
- /**
320
- *
321
- * Destroys a cookie with a particular name.
322
- *
323
- * @param ctx
324
- * @param name
325
- * @param options
326
- */
327
- function destroyCookie(ctx, name, options) {
328
- var opts = __assign(__assign({}, (options || {})), { maxAge: -1 });
329
- if (ctx && ctx.res && ctx.res.setHeader && ctx.res.getHeader) {
330
- var cookies = ctx.res.getHeader('Set-Cookie') || [];
331
- if (typeof cookies === 'string')
332
- cookies = [cookies];
333
- if (typeof cookies === 'number')
334
- cookies = [];
335
- cookies.push(index$4.cookie.serialize(name, '', opts));
336
- ctx.res.setHeader('Set-Cookie', cookies);
337
- }
338
- if (isBrowser()) {
339
- document.cookie = index$4.cookie.serialize(name, '', opts);
340
- }
341
- return {};
342
- }
343
- exports.destroyCookie = destroyCookie;
344
- exports.default = {
345
- set: setCookie$1,
346
- get: parseCookies,
347
- destroy: destroyCookie,
348
- };
349
-
350
- });
351
-
352
- _commonjsHelpers.unwrapExports(dist);
353
- var dist_1 = dist.destroyCookie;
354
- var dist_2 = dist.setCookie;
355
- var dist_3 = dist.parseCookies;
356
-
357
- var _this = undefined;
358
-
359
- var getRelatedArticle = function () {
360
- var _ref2 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
361
- var ctx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
362
- var client = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
363
- var article = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
364
- var prevUrl = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
365
- var articleCount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
366
-
367
- var taxonomyMapping, _article$url, url, content_placement, taxonomy, params, conditions, cookies, prevSlugs, relatedArticleQuery, relatedArticle;
368
-
369
- return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
370
- while (1) {
371
- switch (_context.prev = _context.next) {
372
- case 0:
373
- taxonomyMapping = article.taxonomyMapping, _article$url = article.url;
374
- _article$url = _article$url === undefined ? {
375
- current: null
376
- } : _article$url;
377
- url = _article$url.current, content_placement = article.content_placement;
378
- taxonomy = [];
379
- //404 articles were throwing server error
380
-
381
- if (content_placement) {
382
- content_placement.forEach(function (_ref3) {
383
- var path = _ref3.path,
384
- _id = _ref3._id;
385
-
386
- if (!_id || typeof _id == 'undefined') {
387
- return null;
388
- }
389
- var prev_url_to_check = prevUrl;
390
- if (prev_url_to_check.includes('?')) {
391
- prev_url_to_check = prev_url_to_check.split('?')[0];
392
- }
393
- if (prev_url_to_check.endsWith(path) && _id) taxonomy.push(_id);
394
- });
395
- }
396
-
397
- //404 articles were throwing server error
398
- if (taxonomy.length === 0 && taxonomyMapping) {
399
- taxonomyMapping.forEach(function (_ref4) {
400
- var _ref = _ref4._ref;
401
-
402
- if (_ref) {
403
- taxonomy.push(_ref);
404
- }
405
- });
406
- }
407
-
408
- params = {
409
- url: url,
410
- taxonomy: taxonomy,
411
- index: articleCount
412
- };
413
- conditions = '';
414
-
415
- if (ctx && url) {
416
- cookies = dist_3(ctx);
417
- prevSlugs = cookies['prevSlugs'];
418
-
419
- if (!!prevSlugs) {
420
- dist_2(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
421
- conditions = '&& !(url.current in [' + prevSlugs + '])';
422
- } else dist_2(ctx, 'prevSlugs', '"' + url + '"', {});
423
- }
424
- relatedArticleQuery = getQuery('related', conditions, '', articleCount);
425
- _context.next = 12;
426
- return client.fetch(relatedArticleQuery, params);
427
-
428
- case 12:
429
- relatedArticle = _context.sent;
430
- return _context.abrupt('return', relatedArticle);
431
-
432
- case 14:
433
- case 'end':
434
- return _context.stop();
435
- }
436
- }
437
- }, _callee, _this);
438
- }));
439
-
440
- return function getRelatedArticle() {
441
- return _ref2.apply(this, arguments);
442
- };
443
- }();
444
-
445
- exports.dist_2 = dist_2;
446
- exports.dist_3 = dist_3;
447
- exports.getRelatedArticle = getRelatedArticle;
@@ -1,211 +0,0 @@
1
- 'use strict';
2
-
3
- /*!
4
- * cookie
5
- * Copyright(c) 2012-2014 Roman Shtylman
6
- * Copyright(c) 2015 Douglas Christopher Wilson
7
- * MIT Licensed
8
- */
9
-
10
- /**
11
- * Module exports.
12
- * @public
13
- */
14
-
15
- var parse_1 = parse;
16
- var serialize_1 = serialize;
17
-
18
- /**
19
- * Module variables.
20
- * @private
21
- */
22
-
23
- var decode = decodeURIComponent;
24
- var encode = encodeURIComponent;
25
- var pairSplitRegExp = /; */;
26
-
27
- /**
28
- * RegExp to match field-content in RFC 7230 sec 3.2
29
- *
30
- * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
31
- * field-vchar = VCHAR / obs-text
32
- * obs-text = %x80-FF
33
- */
34
-
35
- var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
36
-
37
- /**
38
- * Parse a cookie header.
39
- *
40
- * Parse the given cookie header string into an object
41
- * The object has the various cookies as keys(names) => values
42
- *
43
- * @param {string} str
44
- * @param {object} [options]
45
- * @return {object}
46
- * @public
47
- */
48
-
49
- function parse(str, options) {
50
- if (typeof str !== 'string') {
51
- throw new TypeError('argument str must be a string');
52
- }
53
-
54
- var obj = {};
55
- var opt = options || {};
56
- var pairs = str.split(pairSplitRegExp);
57
- var dec = opt.decode || decode;
58
-
59
- for (var i = 0; i < pairs.length; i++) {
60
- var pair = pairs[i];
61
- var eq_idx = pair.indexOf('=');
62
-
63
- // skip things that don't look like key=value
64
- if (eq_idx < 0) {
65
- continue;
66
- }
67
-
68
- var key = pair.substr(0, eq_idx).trim();
69
- var val = pair.substr(++eq_idx, pair.length).trim();
70
-
71
- // quoted values
72
- if ('"' == val[0]) {
73
- val = val.slice(1, -1);
74
- }
75
-
76
- // only assign once
77
- if (undefined == obj[key]) {
78
- obj[key] = tryDecode(val, dec);
79
- }
80
- }
81
-
82
- return obj;
83
- }
84
-
85
- /**
86
- * Serialize data into a cookie header.
87
- *
88
- * Serialize the a name value pair into a cookie string suitable for
89
- * http headers. An optional options object specified cookie parameters.
90
- *
91
- * serialize('foo', 'bar', { httpOnly: true })
92
- * => "foo=bar; httpOnly"
93
- *
94
- * @param {string} name
95
- * @param {string} val
96
- * @param {object} [options]
97
- * @return {string}
98
- * @public
99
- */
100
-
101
- function serialize(name, val, options) {
102
- var opt = options || {};
103
- var enc = opt.encode || encode;
104
-
105
- if (typeof enc !== 'function') {
106
- throw new TypeError('option encode is invalid');
107
- }
108
-
109
- if (!fieldContentRegExp.test(name)) {
110
- throw new TypeError('argument name is invalid');
111
- }
112
-
113
- var value = enc(val);
114
-
115
- if (value && !fieldContentRegExp.test(value)) {
116
- throw new TypeError('argument val is invalid');
117
- }
118
-
119
- var str = name + '=' + value;
120
-
121
- if (null != opt.maxAge) {
122
- var maxAge = opt.maxAge - 0;
123
-
124
- if (isNaN(maxAge) || !isFinite(maxAge)) {
125
- throw new TypeError('option maxAge is invalid')
126
- }
127
-
128
- str += '; Max-Age=' + Math.floor(maxAge);
129
- }
130
-
131
- if (opt.domain) {
132
- if (!fieldContentRegExp.test(opt.domain)) {
133
- throw new TypeError('option domain is invalid');
134
- }
135
-
136
- str += '; Domain=' + opt.domain;
137
- }
138
-
139
- if (opt.path) {
140
- if (!fieldContentRegExp.test(opt.path)) {
141
- throw new TypeError('option path is invalid');
142
- }
143
-
144
- str += '; Path=' + opt.path;
145
- }
146
-
147
- if (opt.expires) {
148
- if (typeof opt.expires.toUTCString !== 'function') {
149
- throw new TypeError('option expires is invalid');
150
- }
151
-
152
- str += '; Expires=' + opt.expires.toUTCString();
153
- }
154
-
155
- if (opt.httpOnly) {
156
- str += '; HttpOnly';
157
- }
158
-
159
- if (opt.secure) {
160
- str += '; Secure';
161
- }
162
-
163
- if (opt.sameSite) {
164
- var sameSite = typeof opt.sameSite === 'string'
165
- ? opt.sameSite.toLowerCase() : opt.sameSite;
166
-
167
- switch (sameSite) {
168
- case true:
169
- str += '; SameSite=Strict';
170
- break;
171
- case 'lax':
172
- str += '; SameSite=Lax';
173
- break;
174
- case 'strict':
175
- str += '; SameSite=Strict';
176
- break;
177
- case 'none':
178
- str += '; SameSite=None';
179
- break;
180
- default:
181
- throw new TypeError('option sameSite is invalid');
182
- }
183
- }
184
-
185
- return str;
186
- }
187
-
188
- /**
189
- * Try decoding a string using a decoding function.
190
- *
191
- * @param {string} str
192
- * @param {function} decode
193
- * @private
194
- */
195
-
196
- function tryDecode(str, decode) {
197
- try {
198
- return decode(str);
199
- } catch (e) {
200
- return str;
201
- }
202
- }
203
-
204
- var cookie = {
205
- parse: parse_1,
206
- serialize: serialize_1
207
- };
208
-
209
- exports.cookie = cookie;
210
- exports.parse_1 = parse_1;
211
- exports.serialize_1 = serialize_1;