@mjhls/mjh-framework 1.0.626-iOS-chrome-fix → 1.0.626-iOS-chrome-fix-v2

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