@mjhls/mjh-framework 1.0.720-navigation-scroll-fix-v3 → 1.0.720-navigation-scroll-fix-v4
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.
- package/dist/cjs/Auth.js +6 -206
- package/dist/cjs/HamMagazine.js +1 -2
- package/dist/cjs/View.js +2 -2
- package/dist/cjs/getRelatedArticle.js +416 -5
- package/dist/cjs/index-bd6c9f56.js +211 -0
- package/dist/cjs/index.js +3 -3
- package/dist/esm/Auth.js +1 -201
- package/dist/esm/HamMagazine.js +1 -2
- package/dist/esm/View.js +2 -2
- package/dist/esm/getRelatedArticle.js +416 -5
- package/dist/esm/index-db3bb315.js +207 -0
- package/dist/esm/index.js +2 -2
- package/package.json +1 -1
package/dist/esm/Auth.js
CHANGED
|
@@ -15,6 +15,7 @@ import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-502
|
|
|
15
15
|
import './_set-species-3f8319f5.js';
|
|
16
16
|
import { Col, Form, Button, Spinner } from 'react-bootstrap';
|
|
17
17
|
import { u as util } from './util-7700fc59.js';
|
|
18
|
+
import { s as serialize_1, p as parse_1 } from './index-db3bb315.js';
|
|
18
19
|
import useSWR from 'swr';
|
|
19
20
|
import Local from 'passport-local';
|
|
20
21
|
import mysql from 'mysql';
|
|
@@ -1202,207 +1203,6 @@ var SignupForm$1 = function SignupForm(props) {
|
|
|
1202
1203
|
);
|
|
1203
1204
|
};
|
|
1204
1205
|
|
|
1205
|
-
/*!
|
|
1206
|
-
* cookie
|
|
1207
|
-
* Copyright(c) 2012-2014 Roman Shtylman
|
|
1208
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
1209
|
-
* MIT Licensed
|
|
1210
|
-
*/
|
|
1211
|
-
|
|
1212
|
-
/**
|
|
1213
|
-
* Module exports.
|
|
1214
|
-
* @public
|
|
1215
|
-
*/
|
|
1216
|
-
|
|
1217
|
-
var parse_1 = parse;
|
|
1218
|
-
var serialize_1 = serialize;
|
|
1219
|
-
|
|
1220
|
-
/**
|
|
1221
|
-
* Module variables.
|
|
1222
|
-
* @private
|
|
1223
|
-
*/
|
|
1224
|
-
|
|
1225
|
-
var decode = decodeURIComponent;
|
|
1226
|
-
var encode = encodeURIComponent;
|
|
1227
|
-
var pairSplitRegExp = /; */;
|
|
1228
|
-
|
|
1229
|
-
/**
|
|
1230
|
-
* RegExp to match field-content in RFC 7230 sec 3.2
|
|
1231
|
-
*
|
|
1232
|
-
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
|
|
1233
|
-
* field-vchar = VCHAR / obs-text
|
|
1234
|
-
* obs-text = %x80-FF
|
|
1235
|
-
*/
|
|
1236
|
-
|
|
1237
|
-
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
1238
|
-
|
|
1239
|
-
/**
|
|
1240
|
-
* Parse a cookie header.
|
|
1241
|
-
*
|
|
1242
|
-
* Parse the given cookie header string into an object
|
|
1243
|
-
* The object has the various cookies as keys(names) => values
|
|
1244
|
-
*
|
|
1245
|
-
* @param {string} str
|
|
1246
|
-
* @param {object} [options]
|
|
1247
|
-
* @return {object}
|
|
1248
|
-
* @public
|
|
1249
|
-
*/
|
|
1250
|
-
|
|
1251
|
-
function parse(str, options) {
|
|
1252
|
-
if (typeof str !== 'string') {
|
|
1253
|
-
throw new TypeError('argument str must be a string');
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
var obj = {};
|
|
1257
|
-
var opt = options || {};
|
|
1258
|
-
var pairs = str.split(pairSplitRegExp);
|
|
1259
|
-
var dec = opt.decode || decode;
|
|
1260
|
-
|
|
1261
|
-
for (var i = 0; i < pairs.length; i++) {
|
|
1262
|
-
var pair = pairs[i];
|
|
1263
|
-
var eq_idx = pair.indexOf('=');
|
|
1264
|
-
|
|
1265
|
-
// skip things that don't look like key=value
|
|
1266
|
-
if (eq_idx < 0) {
|
|
1267
|
-
continue;
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
var key = pair.substr(0, eq_idx).trim();
|
|
1271
|
-
var val = pair.substr(++eq_idx, pair.length).trim();
|
|
1272
|
-
|
|
1273
|
-
// quoted values
|
|
1274
|
-
if ('"' == val[0]) {
|
|
1275
|
-
val = val.slice(1, -1);
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
// only assign once
|
|
1279
|
-
if (undefined == obj[key]) {
|
|
1280
|
-
obj[key] = tryDecode(val, dec);
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
return obj;
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
/**
|
|
1288
|
-
* Serialize data into a cookie header.
|
|
1289
|
-
*
|
|
1290
|
-
* Serialize the a name value pair into a cookie string suitable for
|
|
1291
|
-
* http headers. An optional options object specified cookie parameters.
|
|
1292
|
-
*
|
|
1293
|
-
* serialize('foo', 'bar', { httpOnly: true })
|
|
1294
|
-
* => "foo=bar; httpOnly"
|
|
1295
|
-
*
|
|
1296
|
-
* @param {string} name
|
|
1297
|
-
* @param {string} val
|
|
1298
|
-
* @param {object} [options]
|
|
1299
|
-
* @return {string}
|
|
1300
|
-
* @public
|
|
1301
|
-
*/
|
|
1302
|
-
|
|
1303
|
-
function serialize(name, val, options) {
|
|
1304
|
-
var opt = options || {};
|
|
1305
|
-
var enc = opt.encode || encode;
|
|
1306
|
-
|
|
1307
|
-
if (typeof enc !== 'function') {
|
|
1308
|
-
throw new TypeError('option encode is invalid');
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
if (!fieldContentRegExp.test(name)) {
|
|
1312
|
-
throw new TypeError('argument name is invalid');
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
var value = enc(val);
|
|
1316
|
-
|
|
1317
|
-
if (value && !fieldContentRegExp.test(value)) {
|
|
1318
|
-
throw new TypeError('argument val is invalid');
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
var str = name + '=' + value;
|
|
1322
|
-
|
|
1323
|
-
if (null != opt.maxAge) {
|
|
1324
|
-
var maxAge = opt.maxAge - 0;
|
|
1325
|
-
|
|
1326
|
-
if (isNaN(maxAge) || !isFinite(maxAge)) {
|
|
1327
|
-
throw new TypeError('option maxAge is invalid')
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
str += '; Max-Age=' + Math.floor(maxAge);
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
if (opt.domain) {
|
|
1334
|
-
if (!fieldContentRegExp.test(opt.domain)) {
|
|
1335
|
-
throw new TypeError('option domain is invalid');
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
str += '; Domain=' + opt.domain;
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
if (opt.path) {
|
|
1342
|
-
if (!fieldContentRegExp.test(opt.path)) {
|
|
1343
|
-
throw new TypeError('option path is invalid');
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
str += '; Path=' + opt.path;
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
if (opt.expires) {
|
|
1350
|
-
if (typeof opt.expires.toUTCString !== 'function') {
|
|
1351
|
-
throw new TypeError('option expires is invalid');
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
str += '; Expires=' + opt.expires.toUTCString();
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
if (opt.httpOnly) {
|
|
1358
|
-
str += '; HttpOnly';
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
if (opt.secure) {
|
|
1362
|
-
str += '; Secure';
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
if (opt.sameSite) {
|
|
1366
|
-
var sameSite = typeof opt.sameSite === 'string'
|
|
1367
|
-
? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
1368
|
-
|
|
1369
|
-
switch (sameSite) {
|
|
1370
|
-
case true:
|
|
1371
|
-
str += '; SameSite=Strict';
|
|
1372
|
-
break;
|
|
1373
|
-
case 'lax':
|
|
1374
|
-
str += '; SameSite=Lax';
|
|
1375
|
-
break;
|
|
1376
|
-
case 'strict':
|
|
1377
|
-
str += '; SameSite=Strict';
|
|
1378
|
-
break;
|
|
1379
|
-
case 'none':
|
|
1380
|
-
str += '; SameSite=None';
|
|
1381
|
-
break;
|
|
1382
|
-
default:
|
|
1383
|
-
throw new TypeError('option sameSite is invalid');
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
return str;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
/**
|
|
1391
|
-
* Try decoding a string using a decoding function.
|
|
1392
|
-
*
|
|
1393
|
-
* @param {string} str
|
|
1394
|
-
* @param {function} decode
|
|
1395
|
-
* @private
|
|
1396
|
-
*/
|
|
1397
|
-
|
|
1398
|
-
function tryDecode(str, decode) {
|
|
1399
|
-
try {
|
|
1400
|
-
return decode(str);
|
|
1401
|
-
} catch (e) {
|
|
1402
|
-
return str;
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
1206
|
var TOKEN_NAME = 'token';
|
|
1407
1207
|
var MAX_AGE = 60 * 60 * 8; // 8 hours
|
|
1408
1208
|
|
package/dist/esm/HamMagazine.js
CHANGED
|
@@ -167,7 +167,7 @@ var HamMagazine = function HamMagazine(props) {
|
|
|
167
167
|
}
|
|
168
168
|
var stickyNav = window.addEventListener('scroll', function () {
|
|
169
169
|
// Taking into consideration the height of the top navbar while setting the navigation fixed
|
|
170
|
-
if (window && topNavRef && topNavRef.current && window.pageYOffset + topNavRef.current.clientHeight > navOffsetTop) {
|
|
170
|
+
if (window && topNavRef && topNavRef.current && window.pageYOffset !== 0 && window.pageYOffset + topNavRef.current.clientHeight > navOffsetTop) {
|
|
171
171
|
if (navRef.current && navRef.current.style) {
|
|
172
172
|
navRef.current.style.position = 'fixed';
|
|
173
173
|
if (mastNav && mastNav.offsetHeight) navRef.current.style.top = mastNav.offsetHeight;
|
|
@@ -175,7 +175,6 @@ var HamMagazine = function HamMagazine(props) {
|
|
|
175
175
|
setIsSticky(true);
|
|
176
176
|
navLinks.style.margin = 'auto';
|
|
177
177
|
} else {
|
|
178
|
-
console.log('setIsSticky:::::::::', navRef.current.style, topNavRef.current.style);
|
|
179
178
|
if (navRef.current && navRef.current.style) {
|
|
180
179
|
topNavRef.current.style.paddingBottom = '0';
|
|
181
180
|
navRef.current.style.position = 'relative';
|
package/dist/esm/View.js
CHANGED
|
@@ -58,9 +58,9 @@ import { _ as _Object$keys } from './keys-8eda7a5c.js';
|
|
|
58
58
|
import 'react-bootstrap/Dropdown';
|
|
59
59
|
import { b as FaMinus, c as FaPlus } from './index.esm-cf08bf18.js';
|
|
60
60
|
import getSeriesDetail from './getSeriesDetail.js';
|
|
61
|
-
import '
|
|
62
|
-
import getQuery from './getQuery.js';
|
|
61
|
+
import './index-db3bb315.js';
|
|
63
62
|
import getRelatedArticle from './getRelatedArticle.js';
|
|
63
|
+
import getQuery from './getQuery.js';
|
|
64
64
|
import { g as getTargeting, a as getContentPlacementUrl } from './getTargeting-7211f12c.js';
|
|
65
65
|
import getKeywords from './getKeywords.js';
|
|
66
66
|
import urlFor from './urlFor.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './_commonjsHelpers-0c4b6f40.js';
|
|
1
|
+
import { c as createCommonjsModule, u as unwrapExports, a as commonjsGlobal } from './_commonjsHelpers-0c4b6f40.js';
|
|
2
2
|
import './_to-object-a4107da3.js';
|
|
3
3
|
import './es6.string.iterator-c990c18c.js';
|
|
4
4
|
import './_library-528f1934.js';
|
|
@@ -7,9 +7,420 @@ import './core.get-iterator-method-e1de7503.js';
|
|
|
7
7
|
import './web.dom.iterable-4439f05a.js';
|
|
8
8
|
import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-502f13b4.js';
|
|
9
9
|
import './_set-species-3f8319f5.js';
|
|
10
|
-
import {
|
|
10
|
+
import { c as cookie } from './index-db3bb315.js';
|
|
11
11
|
import getQuery from './getQuery.js';
|
|
12
12
|
|
|
13
|
+
var defaultParseOptions = {
|
|
14
|
+
decodeValues: true,
|
|
15
|
+
map: false,
|
|
16
|
+
silent: false,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function isNonEmptyString(str) {
|
|
20
|
+
return typeof str === "string" && !!str.trim();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function parseString(setCookieValue, options) {
|
|
24
|
+
var parts = setCookieValue.split(";").filter(isNonEmptyString);
|
|
25
|
+
var nameValue = parts.shift().split("=");
|
|
26
|
+
var name = nameValue.shift();
|
|
27
|
+
var value = nameValue.join("="); // everything after the first =, joined by a "=" if there was more than one part
|
|
28
|
+
|
|
29
|
+
options = options
|
|
30
|
+
? Object.assign({}, defaultParseOptions, options)
|
|
31
|
+
: defaultParseOptions;
|
|
32
|
+
|
|
33
|
+
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
|
+
|
|
42
|
+
var cookie = {
|
|
43
|
+
name: name, // grab everything before the first =
|
|
44
|
+
value: value,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
parts.forEach(function (part) {
|
|
48
|
+
var sides = part.split("=");
|
|
49
|
+
var key = sides.shift().trimLeft().toLowerCase();
|
|
50
|
+
var value = sides.join("=");
|
|
51
|
+
if (key === "expires") {
|
|
52
|
+
cookie.expires = new Date(value);
|
|
53
|
+
} else if (key === "max-age") {
|
|
54
|
+
cookie.maxAge = parseInt(value, 10);
|
|
55
|
+
} else if (key === "secure") {
|
|
56
|
+
cookie.secure = true;
|
|
57
|
+
} else if (key === "httponly") {
|
|
58
|
+
cookie.httpOnly = true;
|
|
59
|
+
} else if (key === "samesite") {
|
|
60
|
+
cookie.sameSite = value;
|
|
61
|
+
} else {
|
|
62
|
+
cookie[key] = value;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return cookie;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function parse(input, options) {
|
|
70
|
+
options = options
|
|
71
|
+
? Object.assign({}, defaultParseOptions, options)
|
|
72
|
+
: defaultParseOptions;
|
|
73
|
+
|
|
74
|
+
if (!input) {
|
|
75
|
+
if (!options.map) {
|
|
76
|
+
return [];
|
|
77
|
+
} else {
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (input.headers && input.headers["set-cookie"]) {
|
|
83
|
+
// fast-path for node.js (which automatically normalizes header names to lower-case
|
|
84
|
+
input = input.headers["set-cookie"];
|
|
85
|
+
} else if (input.headers) {
|
|
86
|
+
// slow-path for other environments - see #25
|
|
87
|
+
var sch =
|
|
88
|
+
input.headers[
|
|
89
|
+
Object.keys(input.headers).find(function (key) {
|
|
90
|
+
return key.toLowerCase() === "set-cookie";
|
|
91
|
+
})
|
|
92
|
+
];
|
|
93
|
+
// warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
|
|
94
|
+
if (!sch && input.headers.cookie && !options.silent) {
|
|
95
|
+
console.warn(
|
|
96
|
+
"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."
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
input = sch;
|
|
100
|
+
}
|
|
101
|
+
if (!Array.isArray(input)) {
|
|
102
|
+
input = [input];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
options = options
|
|
106
|
+
? Object.assign({}, defaultParseOptions, options)
|
|
107
|
+
: defaultParseOptions;
|
|
108
|
+
|
|
109
|
+
if (!options.map) {
|
|
110
|
+
return input.filter(isNonEmptyString).map(function (str) {
|
|
111
|
+
return parseString(str, options);
|
|
112
|
+
});
|
|
113
|
+
} else {
|
|
114
|
+
var cookies = {};
|
|
115
|
+
return input.filter(isNonEmptyString).reduce(function (cookies, str) {
|
|
116
|
+
var cookie = parseString(str, options);
|
|
117
|
+
cookies[cookie.name] = cookie;
|
|
118
|
+
return cookies;
|
|
119
|
+
}, cookies);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/*
|
|
124
|
+
Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
|
|
125
|
+
that are within a single set-cookie field-value, such as in the Expires portion.
|
|
126
|
+
|
|
127
|
+
This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
|
|
128
|
+
Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
|
|
129
|
+
React Native's fetch does this for *every* header, including set-cookie.
|
|
130
|
+
|
|
131
|
+
Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
|
|
132
|
+
Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
|
|
133
|
+
*/
|
|
134
|
+
function splitCookiesString(cookiesString) {
|
|
135
|
+
if (Array.isArray(cookiesString)) {
|
|
136
|
+
return cookiesString;
|
|
137
|
+
}
|
|
138
|
+
if (typeof cookiesString !== "string") {
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var cookiesStrings = [];
|
|
143
|
+
var pos = 0;
|
|
144
|
+
var start;
|
|
145
|
+
var ch;
|
|
146
|
+
var lastComma;
|
|
147
|
+
var nextStart;
|
|
148
|
+
var cookiesSeparatorFound;
|
|
149
|
+
|
|
150
|
+
function skipWhitespace() {
|
|
151
|
+
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
|
|
152
|
+
pos += 1;
|
|
153
|
+
}
|
|
154
|
+
return pos < cookiesString.length;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function notSpecialChar() {
|
|
158
|
+
ch = cookiesString.charAt(pos);
|
|
159
|
+
|
|
160
|
+
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
while (pos < cookiesString.length) {
|
|
164
|
+
start = pos;
|
|
165
|
+
cookiesSeparatorFound = false;
|
|
166
|
+
|
|
167
|
+
while (skipWhitespace()) {
|
|
168
|
+
ch = cookiesString.charAt(pos);
|
|
169
|
+
if (ch === ",") {
|
|
170
|
+
// ',' is a cookie separator if we have later first '=', not ';' or ','
|
|
171
|
+
lastComma = pos;
|
|
172
|
+
pos += 1;
|
|
173
|
+
|
|
174
|
+
skipWhitespace();
|
|
175
|
+
nextStart = pos;
|
|
176
|
+
|
|
177
|
+
while (pos < cookiesString.length && notSpecialChar()) {
|
|
178
|
+
pos += 1;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// currently special character
|
|
182
|
+
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
183
|
+
// we found cookies separator
|
|
184
|
+
cookiesSeparatorFound = true;
|
|
185
|
+
// pos is inside the next cookie, so back up and return it.
|
|
186
|
+
pos = nextStart;
|
|
187
|
+
cookiesStrings.push(cookiesString.substring(start, lastComma));
|
|
188
|
+
start = pos;
|
|
189
|
+
} else {
|
|
190
|
+
// in param ',' or param separator ';',
|
|
191
|
+
// we continue from that comma
|
|
192
|
+
pos = lastComma + 1;
|
|
193
|
+
}
|
|
194
|
+
} else {
|
|
195
|
+
pos += 1;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
|
200
|
+
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return cookiesStrings;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
var setCookie = parse;
|
|
208
|
+
var parse_1 = parse;
|
|
209
|
+
var parseString_1 = parseString;
|
|
210
|
+
var splitCookiesString_1 = splitCookiesString;
|
|
211
|
+
setCookie.parse = parse_1;
|
|
212
|
+
setCookie.parseString = parseString_1;
|
|
213
|
+
setCookie.splitCookiesString = splitCookiesString_1;
|
|
214
|
+
|
|
215
|
+
var utils = createCommonjsModule(function (module, exports) {
|
|
216
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
217
|
+
__assign = Object.assign || function(t) {
|
|
218
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
219
|
+
s = arguments[i];
|
|
220
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
221
|
+
t[p] = s[p];
|
|
222
|
+
}
|
|
223
|
+
return t;
|
|
224
|
+
};
|
|
225
|
+
return __assign.apply(this, arguments);
|
|
226
|
+
};
|
|
227
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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
|
+
*/
|
|
255
|
+
function hasSameProperties(a, b) {
|
|
256
|
+
var aProps = Object.getOwnPropertyNames(a);
|
|
257
|
+
var bProps = Object.getOwnPropertyNames(b);
|
|
258
|
+
if (aProps.length !== bProps.length) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
for (var i = 0; i < aProps.length; i++) {
|
|
262
|
+
var propName = aProps[i];
|
|
263
|
+
if (a[propName] !== b[propName]) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
exports.hasSameProperties = hasSameProperties;
|
|
270
|
+
/**
|
|
271
|
+
* Compare the cookie and return true if the cookies have equivalent
|
|
272
|
+
* options and the cookies would be overwritten in the browser storage.
|
|
273
|
+
*
|
|
274
|
+
* @param a first Cookie for comparison
|
|
275
|
+
* @param b second Cookie for comparison
|
|
276
|
+
*/
|
|
277
|
+
function areCookiesEqual(a, b) {
|
|
278
|
+
var sameSiteSame = a.sameSite === b.sameSite;
|
|
279
|
+
if (typeof a.sameSite === 'string' && typeof b.sameSite === 'string') {
|
|
280
|
+
sameSiteSame = a.sameSite.toLowerCase() === b.sameSite.toLowerCase();
|
|
281
|
+
}
|
|
282
|
+
return (hasSameProperties(__assign(__assign({}, a), { sameSite: undefined }), __assign(__assign({}, b), { sameSite: undefined })) && sameSiteSame);
|
|
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
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Parses cookies.
|
|
314
|
+
*
|
|
315
|
+
* @param ctx NextJS page or API context, express context, null or undefined.
|
|
316
|
+
* @param options Options that we pass down to `cookie` library.
|
|
317
|
+
*/
|
|
318
|
+
function parseCookies(ctx, options) {
|
|
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) {
|
|
321
|
+
return cookie.parse(ctx.req.headers.cookie, options);
|
|
322
|
+
}
|
|
323
|
+
if (utils.isBrowser()) {
|
|
324
|
+
return cookie.parse(document.cookie, options);
|
|
325
|
+
}
|
|
326
|
+
return {};
|
|
327
|
+
}
|
|
328
|
+
exports.parseCookies = parseCookies;
|
|
329
|
+
/**
|
|
330
|
+
* Sets a cookie.
|
|
331
|
+
*
|
|
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.
|
|
336
|
+
*/
|
|
337
|
+
function setCookie$1(ctx, name, value, options) {
|
|
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
|
+
*/
|
|
351
|
+
var cookies = ctx.res.getHeader('Set-Cookie') || [];
|
|
352
|
+
if (typeof cookies === 'string')
|
|
353
|
+
cookies = [cookies];
|
|
354
|
+
if (typeof cookies === 'number')
|
|
355
|
+
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);
|
|
368
|
+
var cookiesToSet_1 = [];
|
|
369
|
+
parsedCookies.forEach(function (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);
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
cookiesToSet_1.push(cookie.serialize(name, value, options));
|
|
382
|
+
// Update the header.
|
|
383
|
+
ctx.res.setHeader('Set-Cookie', cookiesToSet_1);
|
|
384
|
+
}
|
|
385
|
+
// Browser
|
|
386
|
+
if (utils.isBrowser()) {
|
|
387
|
+
if (options && options.httpOnly) {
|
|
388
|
+
throw new Error('Can not set a httpOnly cookie in the browser.');
|
|
389
|
+
}
|
|
390
|
+
document.cookie = cookie.serialize(name, value, options);
|
|
391
|
+
}
|
|
392
|
+
return {};
|
|
393
|
+
}
|
|
394
|
+
exports.setCookie = setCookie$1;
|
|
395
|
+
/**
|
|
396
|
+
* Destroys a cookie with a particular name.
|
|
397
|
+
*
|
|
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.
|
|
401
|
+
*/
|
|
402
|
+
function destroyCookie(ctx, name, options) {
|
|
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 }));
|
|
408
|
+
}
|
|
409
|
+
exports.destroyCookie = destroyCookie;
|
|
410
|
+
/* Utility Exports */
|
|
411
|
+
exports.default = {
|
|
412
|
+
set: setCookie$1,
|
|
413
|
+
get: parseCookies,
|
|
414
|
+
destroy: destroyCookie,
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
unwrapExports(dist);
|
|
420
|
+
var dist_1 = dist.destroyCookie;
|
|
421
|
+
var dist_2 = dist.setCookie;
|
|
422
|
+
var dist_3 = dist.parseCookies;
|
|
423
|
+
|
|
13
424
|
var _this = undefined;
|
|
14
425
|
|
|
15
426
|
var getRelatedArticle = function () {
|
|
@@ -86,13 +497,13 @@ var getRelatedArticle = function () {
|
|
|
86
497
|
|
|
87
498
|
|
|
88
499
|
if (ctx && url) {
|
|
89
|
-
cookies =
|
|
500
|
+
cookies = dist_3(ctx);
|
|
90
501
|
prevSlugs = cookies['prevSlugs'];
|
|
91
502
|
|
|
92
503
|
if (!!prevSlugs) {
|
|
93
|
-
|
|
504
|
+
dist_2(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
|
|
94
505
|
filters = '&& !(url.current in [' + prevSlugs + '])';
|
|
95
|
-
} else
|
|
506
|
+
} else dist_2(ctx, 'prevSlugs', '"' + url + '"', {});
|
|
96
507
|
}
|
|
97
508
|
|
|
98
509
|
query = getQuery('related', filters, '', articleCount).replace('&& taxonomyMapping[]._ref in $taxonomy', '');
|