@mjhls/mjh-framework 1.0.689-segment → 1.0.689
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/README.md +1 -1
- package/dist/cjs/Auth.js +206 -6
- package/dist/cjs/NavNative.js +4 -18
- package/dist/cjs/PartnerDetailListing.js +4 -1201
- package/dist/cjs/View.js +2 -2
- package/dist/cjs/getRelatedArticle.js +5 -416
- package/dist/cjs/index.js +4 -3
- package/dist/esm/Auth.js +201 -1
- package/dist/esm/NavNative.js +4 -18
- package/dist/esm/PartnerDetailListing.js +4 -1200
- package/dist/esm/View.js +2 -2
- package/dist/esm/getRelatedArticle.js +5 -416
- package/dist/esm/index.js +3 -2
- package/package.json +2 -2
- package/dist/cjs/index-bd6c9f56.js +0 -211
- package/dist/esm/index-db3bb315.js +0 -207
package/README.md
CHANGED
package/dist/cjs/Auth.js
CHANGED
|
@@ -23,7 +23,6 @@ var asyncToGenerator = require('./asyncToGenerator-533d476a.js');
|
|
|
23
23
|
require('./_set-species-f92c67c5.js');
|
|
24
24
|
var reactBootstrap = require('react-bootstrap');
|
|
25
25
|
var util = require('./util-f2c1b65b.js');
|
|
26
|
-
var index$4 = require('./index-bd6c9f56.js');
|
|
27
26
|
var useSWR = _interopDefault(require('swr'));
|
|
28
27
|
var Local = _interopDefault(require('passport-local'));
|
|
29
28
|
var mysql = _interopDefault(require('mysql'));
|
|
@@ -1211,12 +1210,213 @@ var SignupForm$1 = function SignupForm(props) {
|
|
|
1211
1210
|
);
|
|
1212
1211
|
};
|
|
1213
1212
|
|
|
1213
|
+
/*!
|
|
1214
|
+
* cookie
|
|
1215
|
+
* Copyright(c) 2012-2014 Roman Shtylman
|
|
1216
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
1217
|
+
* MIT Licensed
|
|
1218
|
+
*/
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* Module exports.
|
|
1222
|
+
* @public
|
|
1223
|
+
*/
|
|
1224
|
+
|
|
1225
|
+
var parse_1 = parse;
|
|
1226
|
+
var serialize_1 = serialize;
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* Module variables.
|
|
1230
|
+
* @private
|
|
1231
|
+
*/
|
|
1232
|
+
|
|
1233
|
+
var decode = decodeURIComponent;
|
|
1234
|
+
var encode = encodeURIComponent;
|
|
1235
|
+
var pairSplitRegExp = /; */;
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* RegExp to match field-content in RFC 7230 sec 3.2
|
|
1239
|
+
*
|
|
1240
|
+
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
|
|
1241
|
+
* field-vchar = VCHAR / obs-text
|
|
1242
|
+
* obs-text = %x80-FF
|
|
1243
|
+
*/
|
|
1244
|
+
|
|
1245
|
+
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Parse a cookie header.
|
|
1249
|
+
*
|
|
1250
|
+
* Parse the given cookie header string into an object
|
|
1251
|
+
* The object has the various cookies as keys(names) => values
|
|
1252
|
+
*
|
|
1253
|
+
* @param {string} str
|
|
1254
|
+
* @param {object} [options]
|
|
1255
|
+
* @return {object}
|
|
1256
|
+
* @public
|
|
1257
|
+
*/
|
|
1258
|
+
|
|
1259
|
+
function parse(str, options) {
|
|
1260
|
+
if (typeof str !== 'string') {
|
|
1261
|
+
throw new TypeError('argument str must be a string');
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
var obj = {};
|
|
1265
|
+
var opt = options || {};
|
|
1266
|
+
var pairs = str.split(pairSplitRegExp);
|
|
1267
|
+
var dec = opt.decode || decode;
|
|
1268
|
+
|
|
1269
|
+
for (var i = 0; i < pairs.length; i++) {
|
|
1270
|
+
var pair = pairs[i];
|
|
1271
|
+
var eq_idx = pair.indexOf('=');
|
|
1272
|
+
|
|
1273
|
+
// skip things that don't look like key=value
|
|
1274
|
+
if (eq_idx < 0) {
|
|
1275
|
+
continue;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
var key = pair.substr(0, eq_idx).trim();
|
|
1279
|
+
var val = pair.substr(++eq_idx, pair.length).trim();
|
|
1280
|
+
|
|
1281
|
+
// quoted values
|
|
1282
|
+
if ('"' == val[0]) {
|
|
1283
|
+
val = val.slice(1, -1);
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
// only assign once
|
|
1287
|
+
if (undefined == obj[key]) {
|
|
1288
|
+
obj[key] = tryDecode(val, dec);
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
return obj;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* Serialize data into a cookie header.
|
|
1297
|
+
*
|
|
1298
|
+
* Serialize the a name value pair into a cookie string suitable for
|
|
1299
|
+
* http headers. An optional options object specified cookie parameters.
|
|
1300
|
+
*
|
|
1301
|
+
* serialize('foo', 'bar', { httpOnly: true })
|
|
1302
|
+
* => "foo=bar; httpOnly"
|
|
1303
|
+
*
|
|
1304
|
+
* @param {string} name
|
|
1305
|
+
* @param {string} val
|
|
1306
|
+
* @param {object} [options]
|
|
1307
|
+
* @return {string}
|
|
1308
|
+
* @public
|
|
1309
|
+
*/
|
|
1310
|
+
|
|
1311
|
+
function serialize(name, val, options) {
|
|
1312
|
+
var opt = options || {};
|
|
1313
|
+
var enc = opt.encode || encode;
|
|
1314
|
+
|
|
1315
|
+
if (typeof enc !== 'function') {
|
|
1316
|
+
throw new TypeError('option encode is invalid');
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
if (!fieldContentRegExp.test(name)) {
|
|
1320
|
+
throw new TypeError('argument name is invalid');
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
var value = enc(val);
|
|
1324
|
+
|
|
1325
|
+
if (value && !fieldContentRegExp.test(value)) {
|
|
1326
|
+
throw new TypeError('argument val is invalid');
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
var str = name + '=' + value;
|
|
1330
|
+
|
|
1331
|
+
if (null != opt.maxAge) {
|
|
1332
|
+
var maxAge = opt.maxAge - 0;
|
|
1333
|
+
|
|
1334
|
+
if (isNaN(maxAge) || !isFinite(maxAge)) {
|
|
1335
|
+
throw new TypeError('option maxAge is invalid')
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
str += '; Max-Age=' + Math.floor(maxAge);
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
if (opt.domain) {
|
|
1342
|
+
if (!fieldContentRegExp.test(opt.domain)) {
|
|
1343
|
+
throw new TypeError('option domain is invalid');
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
str += '; Domain=' + opt.domain;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
if (opt.path) {
|
|
1350
|
+
if (!fieldContentRegExp.test(opt.path)) {
|
|
1351
|
+
throw new TypeError('option path is invalid');
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
str += '; Path=' + opt.path;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
if (opt.expires) {
|
|
1358
|
+
if (typeof opt.expires.toUTCString !== 'function') {
|
|
1359
|
+
throw new TypeError('option expires is invalid');
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
str += '; Expires=' + opt.expires.toUTCString();
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
if (opt.httpOnly) {
|
|
1366
|
+
str += '; HttpOnly';
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
if (opt.secure) {
|
|
1370
|
+
str += '; Secure';
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
if (opt.sameSite) {
|
|
1374
|
+
var sameSite = typeof opt.sameSite === 'string'
|
|
1375
|
+
? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
1376
|
+
|
|
1377
|
+
switch (sameSite) {
|
|
1378
|
+
case true:
|
|
1379
|
+
str += '; SameSite=Strict';
|
|
1380
|
+
break;
|
|
1381
|
+
case 'lax':
|
|
1382
|
+
str += '; SameSite=Lax';
|
|
1383
|
+
break;
|
|
1384
|
+
case 'strict':
|
|
1385
|
+
str += '; SameSite=Strict';
|
|
1386
|
+
break;
|
|
1387
|
+
case 'none':
|
|
1388
|
+
str += '; SameSite=None';
|
|
1389
|
+
break;
|
|
1390
|
+
default:
|
|
1391
|
+
throw new TypeError('option sameSite is invalid');
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
return str;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Try decoding a string using a decoding function.
|
|
1400
|
+
*
|
|
1401
|
+
* @param {string} str
|
|
1402
|
+
* @param {function} decode
|
|
1403
|
+
* @private
|
|
1404
|
+
*/
|
|
1405
|
+
|
|
1406
|
+
function tryDecode(str, decode) {
|
|
1407
|
+
try {
|
|
1408
|
+
return decode(str);
|
|
1409
|
+
} catch (e) {
|
|
1410
|
+
return str;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1214
1414
|
var TOKEN_NAME = 'token';
|
|
1215
1415
|
var MAX_AGE = 60 * 60 * 8; // 8 hours
|
|
1216
1416
|
|
|
1217
1417
|
function setTokenCookie(res, token, eKey) {
|
|
1218
1418
|
var cookies_serailized = [];
|
|
1219
|
-
cookies_serailized.push(
|
|
1419
|
+
cookies_serailized.push(serialize_1(TOKEN_NAME, token, {
|
|
1220
1420
|
//maxAge: MAX_AGE, // we want login cookie to expire when browser
|
|
1221
1421
|
//expires: new Date(Date.now() + MAX_AGE * 1000),
|
|
1222
1422
|
//httpOnly: true,
|
|
@@ -1225,7 +1425,7 @@ function setTokenCookie(res, token, eKey) {
|
|
|
1225
1425
|
//sameSite: 'lax',
|
|
1226
1426
|
}));
|
|
1227
1427
|
|
|
1228
|
-
cookies_serailized.push(
|
|
1428
|
+
cookies_serailized.push(serialize_1('eKey', eKey, {
|
|
1229
1429
|
//maxAge: MAX_AGE, // we want login cookie to expire when browser
|
|
1230
1430
|
//expires: new Date(Date.now() + MAX_AGE * 1000),
|
|
1231
1431
|
//httpOnly: true,
|
|
@@ -1239,12 +1439,12 @@ function setTokenCookie(res, token, eKey) {
|
|
|
1239
1439
|
|
|
1240
1440
|
function removeTokenCookie(res) {
|
|
1241
1441
|
var cookies_serailized = [];
|
|
1242
|
-
cookies_serailized.push(
|
|
1442
|
+
cookies_serailized.push(serialize_1(TOKEN_NAME, '', {
|
|
1243
1443
|
maxAge: -1,
|
|
1244
1444
|
expires: new Date(Date.now() - MAX_AGE * 1000),
|
|
1245
1445
|
path: '/'
|
|
1246
1446
|
}));
|
|
1247
|
-
cookies_serailized.push(
|
|
1447
|
+
cookies_serailized.push(serialize_1('eKey', '', {
|
|
1248
1448
|
maxAge: -1,
|
|
1249
1449
|
expires: new Date(Date.now() - MAX_AGE * 1000),
|
|
1250
1450
|
path: '/'
|
|
@@ -1259,7 +1459,7 @@ function parseCookies(req) {
|
|
|
1259
1459
|
|
|
1260
1460
|
// For pages we do need to parse the cookies.
|
|
1261
1461
|
var cookie = req.headers ? req.headers.cookie : null;
|
|
1262
|
-
return
|
|
1462
|
+
return parse_1(cookie || '');
|
|
1263
1463
|
}
|
|
1264
1464
|
|
|
1265
1465
|
function getTokenCookie(req) {
|
package/dist/cjs/NavNative.js
CHANGED
|
@@ -92,23 +92,13 @@ var NavNative = function NavNative(props) {
|
|
|
92
92
|
var topNavHeight = document.querySelector('.nav-brands') && document.querySelector('.nav-brands').offsetHeight;
|
|
93
93
|
// Setting the top of the search component based on the offset of navigation component.
|
|
94
94
|
searchRef.current.style.top = (topNavHeight ? topNavHeight + navRef.current.offsetHeight : navRef.current.offsetHeight) + 1 + 'px';
|
|
95
|
-
}, []);
|
|
96
|
-
|
|
97
|
-
React.useEffect(function () {
|
|
98
|
-
|
|
99
|
-
var navdropdowns = navRef.current.querySelectorAll('#basic-nav-dropdown');
|
|
100
|
-
console.log('navdropdowns:', navdropdowns);
|
|
101
95
|
|
|
102
96
|
setTimeout(function () {
|
|
103
|
-
|
|
104
97
|
var segmentLinks = navRef.current.querySelectorAll('a[needsegmentsupport="true"]');
|
|
105
|
-
console.log('segmentLinks:', segmentLinks);
|
|
106
98
|
for (var i = 0; i < segmentLinks.length; i++) {
|
|
107
99
|
var link = segmentLinks[i];
|
|
108
100
|
var href = link.getAttribute('href');
|
|
109
101
|
var newRef = Segment.getURL(href, { needSegmentSupport: true });
|
|
110
|
-
console.log('href:', href);
|
|
111
|
-
console.log('newRef:', newRef);
|
|
112
102
|
link.setAttribute('href', newRef);
|
|
113
103
|
}
|
|
114
104
|
}, 1000);
|
|
@@ -433,19 +423,15 @@ var NavNative = function NavNative(props) {
|
|
|
433
423
|
{ key: 'subnav-' + index },
|
|
434
424
|
React__default.createElement(
|
|
435
425
|
NavDropdown,
|
|
436
|
-
{ key: index, title: row.name, id: 'basic-nav-dropdown'
|
|
426
|
+
{ key: index, title: row.name, id: 'basic-nav-dropdown' },
|
|
437
427
|
row.subQuery && row.subQuery.map(function (ddRow, subIndex) {
|
|
438
428
|
if (ddRow.type === 'divider') {
|
|
439
429
|
return React__default.createElement(NavDropdown.Divider, { key: subIndex });
|
|
440
430
|
} else {
|
|
441
431
|
return ddRow.url && ddRow.name ? React__default.createElement(
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
NavDropdown.Link,
|
|
446
|
-
{ key: subIndex, needsegmentsupport: ddRow.needSegmentSupport ? 'true' : '', href: ddRow.url, target: ddRow.blank ? '_blank' : '_self', className: 'dropdown-item' },
|
|
447
|
-
ddRow.name
|
|
448
|
-
)
|
|
432
|
+
'a',
|
|
433
|
+
{ key: subIndex, needsegmentsupport: ddRow.needSegmentSupport ? 'true' : '', href: ddRow.url, target: ddRow.blank ? '_blank' : '_self', className: 'dropdown-item' },
|
|
434
|
+
ddRow.name
|
|
449
435
|
) : null;
|
|
450
436
|
}
|
|
451
437
|
})
|