@mjhls/mjh-framework 1.0.119 → 1.0.120

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/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import React__default, { Component, useState, useEffect, useRef, createElement, createContext } from 'react';
1
+ import React__default, { Component, useState, useEffect, useRef, useLayoutEffect, createElement, createContext } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import reactDom from 'react-dom';
4
4
  import Container from 'react-bootstrap/Container';
@@ -9,6 +9,8 @@ import Link from 'next/link';
9
9
  import { withRouter, useRouter } from 'next/router';
10
10
  import Media from 'react-bootstrap/Media';
11
11
  import { Media as Media$1, Container as Container$1, Dropdown, Figure, Carousel, Table, Button as Button$1, ProgressBar, Card as Card$1 } from 'react-bootstrap';
12
+ import Button from 'react-bootstrap/Button';
13
+ import Badge from 'react-bootstrap/Badge';
12
14
  import ListGroup from 'react-bootstrap/ListGroup';
13
15
  import Head from 'next/head';
14
16
  import Accordion from 'react-bootstrap/Accordion';
@@ -16,7 +18,6 @@ import { useAccordionToggle } from 'react-bootstrap/AccordionToggle';
16
18
  import { FacebookShareButton, TwitterShareButton, PinterestShareButton, EmailShareButton, FacebookIcon, TwitterIcon, PinterestIcon, EmailIcon } from 'react-share';
17
19
  import Form from 'react-bootstrap/Form';
18
20
  import FormControl from 'react-bootstrap/FormControl';
19
- import Button from 'react-bootstrap/Button';
20
21
  import Nav from 'react-bootstrap/Nav';
21
22
  import Navbar from 'react-bootstrap/Navbar';
22
23
  import NavDropdown from 'react-bootstrap/NavDropdown';
@@ -12641,6 +12642,221 @@ var VideoSeriesListing = function (_React$Component) {
12641
12642
  }(React__default.Component);
12642
12643
  var VideoSeriesListing$1 = withRouter(VideoSeriesListing);
12643
12644
 
12645
+ var PublicationDeck = function PublicationDeck(props) {
12646
+ var data = props.data,
12647
+ imageHeight = props.imageHeight,
12648
+ imageWidth = props.imageWidth,
12649
+ href = props.href,
12650
+ Website = props.Website,
12651
+ client = props.client;
12652
+
12653
+ var urlFor = function urlFor(source) {
12654
+ var builder = imageUrlBuilder(client);
12655
+ return builder.image(source);
12656
+ };
12657
+
12658
+ var renderCardImage = function renderCardImage(thumbnail) {
12659
+ if (thumbnail && thumbnail.asset) {
12660
+ var url = urlFor(thumbnail);
12661
+ if (imageHeight) url = url.height(imageHeight);
12662
+ if (imageWidth) url = url.width(imageWidth);
12663
+ return url.url();
12664
+ } else {
12665
+ return Website.logo;
12666
+ }
12667
+ };
12668
+
12669
+ return React__default.createElement(
12670
+ Row,
12671
+ null,
12672
+ data && data.map(function (row, index) {
12673
+ return row.identifier && row.identifier.current && React__default.createElement(
12674
+ Col,
12675
+ { md: 12, lg: '4', style: { display: 'flex', flex: '1 0 auto' }, key: index },
12676
+ React__default.createElement(
12677
+ Card,
12678
+ { className: 'block-card', style: { width: '200px' } },
12679
+ React__default.createElement(
12680
+ Link,
12681
+ { href: href + '/' + row.identifier.current },
12682
+ React__default.createElement(
12683
+ 'a',
12684
+ null,
12685
+ row.childIssue && row.childIssue.thumbnail && React__default.createElement(Card.Img, { variant: 'top', src: renderCardImage(row.childIssue.thumbnail), alt: row.name }),
12686
+ React__default.createElement(
12687
+ Card.Body,
12688
+ null,
12689
+ React__default.createElement(
12690
+ Card.Title,
12691
+ null,
12692
+ row.name
12693
+ ),
12694
+ React__default.createElement(
12695
+ Button,
12696
+ { variant: 'secondary' },
12697
+ 'Browse Issues'
12698
+ )
12699
+ )
12700
+ )
12701
+ )
12702
+ )
12703
+ );
12704
+ })
12705
+ );
12706
+ };
12707
+
12708
+ var IssueDeck = function IssueDeck(props) {
12709
+ var data = props.data,
12710
+ href = props.href,
12711
+ imageHeight = props.imageHeight,
12712
+ imageWidth = props.imageWidth,
12713
+ Website = props.Website,
12714
+ client = props.client,
12715
+ publication = props.publication;
12716
+
12717
+
12718
+ var urlFor = function urlFor(source) {
12719
+ var builder = imageUrlBuilder(client);
12720
+ return builder.image(source);
12721
+ };
12722
+
12723
+ var renderCardImage = function renderCardImage(thumbnail) {
12724
+ if (thumbnail && thumbnail.asset) {
12725
+ var url = urlFor(thumbnail);
12726
+ if (imageHeight) url = url.height(imageHeight);
12727
+ if (imageWidth) url = url.width(imageWidth);
12728
+ return url.url();
12729
+ } else {
12730
+ return Website.logo;
12731
+ }
12732
+ };
12733
+
12734
+ return React__default.createElement(
12735
+ Row,
12736
+ null,
12737
+ data && data.map(function (row, index) {
12738
+ return publication && row.identifier && row.identifier.current && React__default.createElement(
12739
+ Col,
12740
+ { md: 12, lg: 12, key: index },
12741
+ React__default.createElement(
12742
+ Link,
12743
+ { href: href + '/' + publication + '/' + row.identifier.current },
12744
+ React__default.createElement(
12745
+ 'a',
12746
+ null,
12747
+ React__default.createElement(
12748
+ Card,
12749
+ { className: 'queue-card journal-queue', style: { borderTop: '1px solid #EEE' } },
12750
+ React__default.createElement(
12751
+ Row,
12752
+ { style: { flexDirection: 'left' } },
12753
+ React__default.createElement(
12754
+ Col,
12755
+ { md: 12, lg: 4 },
12756
+ row.thumbnail && React__default.createElement(Card.Img, { variant: 'top', src: renderCardImage(row.thumbnail), alt: row.name })
12757
+ ),
12758
+ React__default.createElement(
12759
+ Col,
12760
+ null,
12761
+ React__default.createElement(
12762
+ Card.Body,
12763
+ { style: { padding: '20px' } },
12764
+ React__default.createElement(
12765
+ Card.Title,
12766
+ null,
12767
+ row.name
12768
+ ),
12769
+ React__default.createElement(
12770
+ 'div',
12771
+ null,
12772
+ 'Volume: ',
12773
+ row.volume
12774
+ ),
12775
+ React__default.createElement(
12776
+ 'div',
12777
+ null,
12778
+ 'Number: ',
12779
+ row.number
12780
+ ),
12781
+ React__default.createElement(
12782
+ Button,
12783
+ { style: { marginTop: '20px' }, variant: 'secondary' },
12784
+ 'View Issue'
12785
+ )
12786
+ )
12787
+ )
12788
+ )
12789
+ )
12790
+ )
12791
+ )
12792
+ );
12793
+ })
12794
+ );
12795
+ };
12796
+
12797
+ var IssueContentDeck = function IssueContentDeck(props) {
12798
+ var data = props.data,
12799
+ imageHeight = props.imageHeight,
12800
+ imageWidth = props.imageWidth,
12801
+ Website = props.Website,
12802
+ client = props.client;
12803
+
12804
+
12805
+ var urlFor = function urlFor(source) {
12806
+ var builder = imageUrlBuilder(client);
12807
+ return builder.image(source);
12808
+ };
12809
+
12810
+ var renderCardImage = function renderCardImage(thumbnail) {
12811
+ if (thumbnail && thumbnail.asset) {
12812
+ var url = urlFor(thumbnail);
12813
+ if (imageHeight) url = url.height(imageHeight);
12814
+ if (imageWidth) url = url.width(imageWidth);
12815
+ return url.url();
12816
+ } else {
12817
+ return Website.logo;
12818
+ }
12819
+ };
12820
+
12821
+ return React__default.createElement(
12822
+ Row,
12823
+ null,
12824
+ data && data.map(function (row, index) {
12825
+ return row.url && row.url.current && React__default.createElement(
12826
+ Col,
12827
+ { md: 12, lg: 6, style: { display: 'flex', flex: '1 0 auto' }, key: index },
12828
+ React__default.createElement(
12829
+ Card,
12830
+ null,
12831
+ React__default.createElement(
12832
+ Link,
12833
+ { href: '/view/[url]', as: '/view/' + row.url.current },
12834
+ React__default.createElement(
12835
+ 'a',
12836
+ null,
12837
+ row.thumbnail && React__default.createElement(Card.Img, { variant: 'top', src: renderCardImage(row.thumbnail), alt: row.title }),
12838
+ React__default.createElement(
12839
+ Card.Body,
12840
+ null,
12841
+ row.issueSection && row.issueSection.name ? React__default.createElement(
12842
+ Badge,
12843
+ { variant: 'success' },
12844
+ row.issueSection && row.issueSection.name.name
12845
+ ) : '',
12846
+ React__default.createElement(
12847
+ Card.Title,
12848
+ null,
12849
+ row.title
12850
+ )
12851
+ )
12852
+ )
12853
+ )
12854
+ )
12855
+ );
12856
+ })
12857
+ );
12858
+ };
12859
+
12644
12860
  var Column1 = function Column1(props) {
12645
12861
  var title = props.title;
12646
12862
 
@@ -13232,6 +13448,336 @@ var NavFooter = function NavFooter(props) {
13232
13448
  );
13233
13449
  };
13234
13450
 
13451
+ /*!
13452
+ * cookie
13453
+ * Copyright(c) 2012-2014 Roman Shtylman
13454
+ * Copyright(c) 2015 Douglas Christopher Wilson
13455
+ * MIT Licensed
13456
+ */
13457
+
13458
+ /**
13459
+ * Module exports.
13460
+ * @public
13461
+ */
13462
+
13463
+ var parse_1 = parse;
13464
+ var serialize_1 = serialize;
13465
+
13466
+ /**
13467
+ * Module variables.
13468
+ * @private
13469
+ */
13470
+
13471
+ var decode = decodeURIComponent;
13472
+ var encode = encodeURIComponent;
13473
+ var pairSplitRegExp = /; */;
13474
+
13475
+ /**
13476
+ * RegExp to match field-content in RFC 7230 sec 3.2
13477
+ *
13478
+ * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
13479
+ * field-vchar = VCHAR / obs-text
13480
+ * obs-text = %x80-FF
13481
+ */
13482
+
13483
+ var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
13484
+
13485
+ /**
13486
+ * Parse a cookie header.
13487
+ *
13488
+ * Parse the given cookie header string into an object
13489
+ * The object has the various cookies as keys(names) => values
13490
+ *
13491
+ * @param {string} str
13492
+ * @param {object} [options]
13493
+ * @return {object}
13494
+ * @public
13495
+ */
13496
+
13497
+ function parse(str, options) {
13498
+ if (typeof str !== 'string') {
13499
+ throw new TypeError('argument str must be a string');
13500
+ }
13501
+
13502
+ var obj = {};
13503
+ var opt = options || {};
13504
+ var pairs = str.split(pairSplitRegExp);
13505
+ var dec = opt.decode || decode;
13506
+
13507
+ for (var i = 0; i < pairs.length; i++) {
13508
+ var pair = pairs[i];
13509
+ var eq_idx = pair.indexOf('=');
13510
+
13511
+ // skip things that don't look like key=value
13512
+ if (eq_idx < 0) {
13513
+ continue;
13514
+ }
13515
+
13516
+ var key = pair.substr(0, eq_idx).trim();
13517
+ var val = pair.substr(++eq_idx, pair.length).trim();
13518
+
13519
+ // quoted values
13520
+ if ('"' == val[0]) {
13521
+ val = val.slice(1, -1);
13522
+ }
13523
+
13524
+ // only assign once
13525
+ if (undefined == obj[key]) {
13526
+ obj[key] = tryDecode(val, dec);
13527
+ }
13528
+ }
13529
+
13530
+ return obj;
13531
+ }
13532
+
13533
+ /**
13534
+ * Serialize data into a cookie header.
13535
+ *
13536
+ * Serialize the a name value pair into a cookie string suitable for
13537
+ * http headers. An optional options object specified cookie parameters.
13538
+ *
13539
+ * serialize('foo', 'bar', { httpOnly: true })
13540
+ * => "foo=bar; httpOnly"
13541
+ *
13542
+ * @param {string} name
13543
+ * @param {string} val
13544
+ * @param {object} [options]
13545
+ * @return {string}
13546
+ * @public
13547
+ */
13548
+
13549
+ function serialize(name, val, options) {
13550
+ var opt = options || {};
13551
+ var enc = opt.encode || encode;
13552
+
13553
+ if (typeof enc !== 'function') {
13554
+ throw new TypeError('option encode is invalid');
13555
+ }
13556
+
13557
+ if (!fieldContentRegExp.test(name)) {
13558
+ throw new TypeError('argument name is invalid');
13559
+ }
13560
+
13561
+ var value = enc(val);
13562
+
13563
+ if (value && !fieldContentRegExp.test(value)) {
13564
+ throw new TypeError('argument val is invalid');
13565
+ }
13566
+
13567
+ var str = name + '=' + value;
13568
+
13569
+ if (null != opt.maxAge) {
13570
+ var maxAge = opt.maxAge - 0;
13571
+ if (isNaN(maxAge)) throw new Error('maxAge should be a Number');
13572
+ str += '; Max-Age=' + Math.floor(maxAge);
13573
+ }
13574
+
13575
+ if (opt.domain) {
13576
+ if (!fieldContentRegExp.test(opt.domain)) {
13577
+ throw new TypeError('option domain is invalid');
13578
+ }
13579
+
13580
+ str += '; Domain=' + opt.domain;
13581
+ }
13582
+
13583
+ if (opt.path) {
13584
+ if (!fieldContentRegExp.test(opt.path)) {
13585
+ throw new TypeError('option path is invalid');
13586
+ }
13587
+
13588
+ str += '; Path=' + opt.path;
13589
+ }
13590
+
13591
+ if (opt.expires) {
13592
+ if (typeof opt.expires.toUTCString !== 'function') {
13593
+ throw new TypeError('option expires is invalid');
13594
+ }
13595
+
13596
+ str += '; Expires=' + opt.expires.toUTCString();
13597
+ }
13598
+
13599
+ if (opt.httpOnly) {
13600
+ str += '; HttpOnly';
13601
+ }
13602
+
13603
+ if (opt.secure) {
13604
+ str += '; Secure';
13605
+ }
13606
+
13607
+ if (opt.sameSite) {
13608
+ var sameSite = typeof opt.sameSite === 'string'
13609
+ ? opt.sameSite.toLowerCase() : opt.sameSite;
13610
+
13611
+ switch (sameSite) {
13612
+ case true:
13613
+ str += '; SameSite=Strict';
13614
+ break;
13615
+ case 'lax':
13616
+ str += '; SameSite=Lax';
13617
+ break;
13618
+ case 'strict':
13619
+ str += '; SameSite=Strict';
13620
+ break;
13621
+ case 'none':
13622
+ str += '; SameSite=None';
13623
+ break;
13624
+ default:
13625
+ throw new TypeError('option sameSite is invalid');
13626
+ }
13627
+ }
13628
+
13629
+ return str;
13630
+ }
13631
+
13632
+ /**
13633
+ * Try decoding a string using a decoding function.
13634
+ *
13635
+ * @param {string} str
13636
+ * @param {function} decode
13637
+ * @private
13638
+ */
13639
+
13640
+ function tryDecode(str, decode) {
13641
+ try {
13642
+ return decode(str);
13643
+ } catch (e) {
13644
+ return str;
13645
+ }
13646
+ }
13647
+
13648
+ function hasDocumentCookie() {
13649
+ // Can we get/set cookies on document.cookie?
13650
+ return typeof document === 'object' && typeof document.cookie === 'string';
13651
+ }
13652
+ function parseCookies(cookies, options) {
13653
+ if (typeof cookies === 'string') {
13654
+ return parse_1(cookies, options);
13655
+ }
13656
+ else if (typeof cookies === 'object' && cookies !== null) {
13657
+ return cookies;
13658
+ }
13659
+ else {
13660
+ return {};
13661
+ }
13662
+ }
13663
+ function isParsingCookie(value, doNotParse) {
13664
+ if (typeof doNotParse === 'undefined') {
13665
+ // We guess if the cookie start with { or [, it has been serialized
13666
+ doNotParse =
13667
+ !value || (value[0] !== '{' && value[0] !== '[' && value[0] !== '"');
13668
+ }
13669
+ return !doNotParse;
13670
+ }
13671
+ function readCookie(value, options) {
13672
+ if (options === void 0) { options = {}; }
13673
+ var cleanValue = cleanupCookieValue(value);
13674
+ if (isParsingCookie(cleanValue, options.doNotParse)) {
13675
+ try {
13676
+ return JSON.parse(cleanValue);
13677
+ }
13678
+ catch (e) {
13679
+ // At least we tried
13680
+ }
13681
+ }
13682
+ // Ignore clean value if we failed the deserialization
13683
+ // It is not relevant anymore to trim those values
13684
+ return value;
13685
+ }
13686
+ function cleanupCookieValue(value) {
13687
+ // express prepend j: before serializing a cookie
13688
+ if (value && value[0] === 'j' && value[1] === ':') {
13689
+ return value.substr(2);
13690
+ }
13691
+ return value;
13692
+ }
13693
+
13694
+ // We can't please Rollup and TypeScript at the same time
13695
+ // Only way to make both of them work
13696
+ var objectAssign = require('object-assign');
13697
+ var Cookies = /** @class */ (function () {
13698
+ function Cookies(cookies, options) {
13699
+ var _this = this;
13700
+ this.changeListeners = [];
13701
+ this.HAS_DOCUMENT_COOKIE = false;
13702
+ this.cookies = parseCookies(cookies, options);
13703
+ new Promise(function () {
13704
+ _this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();
13705
+ }).catch(function () { });
13706
+ }
13707
+ Cookies.prototype._updateBrowserValues = function (parseOptions) {
13708
+ if (!this.HAS_DOCUMENT_COOKIE) {
13709
+ return;
13710
+ }
13711
+ this.cookies = parse_1(document.cookie, parseOptions);
13712
+ };
13713
+ Cookies.prototype._emitChange = function (params) {
13714
+ for (var i = 0; i < this.changeListeners.length; ++i) {
13715
+ this.changeListeners[i](params);
13716
+ }
13717
+ };
13718
+ Cookies.prototype.get = function (name, options, parseOptions) {
13719
+ if (options === void 0) { options = {}; }
13720
+ this._updateBrowserValues(parseOptions);
13721
+ return readCookie(this.cookies[name], options);
13722
+ };
13723
+ Cookies.prototype.getAll = function (options, parseOptions) {
13724
+ if (options === void 0) { options = {}; }
13725
+ this._updateBrowserValues(parseOptions);
13726
+ var result = {};
13727
+ for (var name_1 in this.cookies) {
13728
+ result[name_1] = readCookie(this.cookies[name_1], options);
13729
+ }
13730
+ return result;
13731
+ };
13732
+ Cookies.prototype.set = function (name, value, options) {
13733
+ var _a;
13734
+ if (typeof value === 'object') {
13735
+ value = JSON.stringify(value);
13736
+ }
13737
+ this.cookies = objectAssign({}, this.cookies, (_a = {}, _a[name] = value, _a));
13738
+ if (this.HAS_DOCUMENT_COOKIE) {
13739
+ document.cookie = serialize_1(name, value, options);
13740
+ }
13741
+ this._emitChange({ name: name, value: value, options: options });
13742
+ };
13743
+ Cookies.prototype.remove = function (name, options) {
13744
+ var finalOptions = (options = objectAssign({}, options, {
13745
+ expires: new Date(1970, 1, 1, 0, 0, 1),
13746
+ maxAge: 0
13747
+ }));
13748
+ this.cookies = objectAssign({}, this.cookies);
13749
+ delete this.cookies[name];
13750
+ if (this.HAS_DOCUMENT_COOKIE) {
13751
+ document.cookie = serialize_1(name, '', finalOptions);
13752
+ }
13753
+ this._emitChange({ name: name, value: undefined, options: options });
13754
+ };
13755
+ Cookies.prototype.addChangeListener = function (callback) {
13756
+ this.changeListeners.push(callback);
13757
+ };
13758
+ Cookies.prototype.removeChangeListener = function (callback) {
13759
+ var idx = this.changeListeners.indexOf(callback);
13760
+ if (idx >= 0) {
13761
+ this.changeListeners.splice(idx, 1);
13762
+ }
13763
+ };
13764
+ return Cookies;
13765
+ }());
13766
+
13767
+ var Cookies$1 = Cookies;
13768
+ // we seem to sometimes get the ES6 version despite requesting cjs here, not sure why
13769
+ // this isn't the ideal fix, but it'll do for now
13770
+ Cookies$1 = Cookies$1.default || Cookies$1;
13771
+
13772
+ function nextCookies(ctx, options) {
13773
+ // Note: Next.js Static export sets ctx.req to a fake request with no headers
13774
+ var header = ctx.req && ctx.req.headers && ctx.req.headers.cookie;
13775
+ var uc = new Cookies$1(header);
13776
+ return uc.getAll(options);
13777
+ }
13778
+
13779
+ var nextCookies_1 = nextCookies;
13780
+
13235
13781
  var NavMagazine = function NavMagazine(props) {
13236
13782
  /*
13237
13783
  Example Nav with acceptable props
@@ -13252,8 +13798,7 @@ var NavMagazine = function NavMagazine(props) {
13252
13798
  website = props.website,
13253
13799
  _props$showLogin = props.showLogin,
13254
13800
  showLogin = _props$showLogin === undefined ? false : _props$showLogin,
13255
- _props$initialLoginSt = props.initialLoginState,
13256
- initialLoginState = _props$initialLoginSt === undefined ? false : _props$initialLoginSt;
13801
+ allCookies = props.allCookies;
13257
13802
 
13258
13803
  var navRef = useRef(null);
13259
13804
 
@@ -13267,6 +13812,8 @@ var NavMagazine = function NavMagazine(props) {
13267
13812
  screenWidth = _useState4[0],
13268
13813
  setScreenWidth = _useState4[1];
13269
13814
 
13815
+ var initialLoginState = allCookies.loggedIn;
13816
+
13270
13817
  var _useState5 = useState(initialLoginState),
13271
13818
  _useState6 = slicedToArray(_useState5, 2),
13272
13819
  loginState = _useState6[0],
@@ -13282,13 +13829,52 @@ var NavMagazine = function NavMagazine(props) {
13282
13829
 
13283
13830
  useEffect(function () {
13284
13831
  setScreenWidth(parseInt(window.innerWidth));
13285
- if (typeof GCN !== 'undefined' && GCN && GCN.onecount) {
13286
- setLoginState(GCN.onecount.isLoggedIn());
13832
+ }, []);
13833
+
13834
+ useLayoutEffect(function () {
13835
+ if (typeof GCN !== 'undefined') {
13836
+ GCN.on('init').then(function (data) {
13837
+ console.log('GCN init...');
13838
+ setLoginState(data.loggedin);
13839
+ if (data.loggedIn) {
13840
+ console.log(' - logged in status');
13841
+ document.cookie = 'loggedIn=' + data.loggedIn + '; path=/';
13842
+ } else {
13843
+ console.log(' - logged out status');
13844
+ document.cookie = 'loggedIn=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT';
13845
+ }
13846
+ });
13847
+
13848
+ GCN.on('login').then(function (data) {
13849
+ setLoginState(data.loggedin);
13850
+ console.log('GCN login...');
13851
+ document.cookie = 'loggedIn=' + data.loggedIn + '; path=/';
13852
+ });
13853
+
13854
+ GCN.on('logout').then(function (data) {
13855
+ setLoginState(data.loggedin);
13856
+ console.log('GCN logout...');
13857
+ document.cookie = 'loggedIn=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT';
13858
+ });
13287
13859
  } else {
13288
- console.error('GCN not defined');
13860
+ console.error('GCN not defined for GCN events');
13289
13861
  }
13290
13862
  }, []);
13291
13863
 
13864
+ useEffect(function () {
13865
+ toggleLogin();
13866
+ }, [loginState]);
13867
+
13868
+ var toggleLogin = function toggleLogin() {
13869
+ if (loginState) {
13870
+ document.getElementsByClassName('logged-in').style.display = '';
13871
+ document.getElementsByClassName('logged-out').style.display = 'none';
13872
+ } else {
13873
+ document.getElementsByClassName('logged-in').style.display = 'none';
13874
+ document.getElementsByClassName('logged-out').style.display = '';
13875
+ }
13876
+ };
13877
+
13292
13878
  var trackScrolling = function trackScrolling() {
13293
13879
  var offsetTop = navRef.current.getBoundingClientRect().top;
13294
13880
 
@@ -13301,8 +13887,13 @@ var NavMagazine = function NavMagazine(props) {
13301
13887
 
13302
13888
  var handleLogin = function handleLogin(e) {
13303
13889
  if (typeof GCN !== 'undefined' && GCN && GCN.onecount) {
13304
- GCN.onecount.login();
13305
- setLoginState(GCN.onecount.isLoggedIn());
13890
+ GCN.onecount.login().then(function (result) {
13891
+ console.log('login result: ', result);
13892
+ setLoginState(GCN.onecount.isLoggedIn());
13893
+ }).catch(function (error) {
13894
+ console.log('login error:', error);
13895
+ setLoginState(GCN.onecount.isLoggedIn());
13896
+ });
13306
13897
  } else {
13307
13898
  console.error('GCN not defined');
13308
13899
  }
@@ -13310,8 +13901,13 @@ var NavMagazine = function NavMagazine(props) {
13310
13901
 
13311
13902
  var handleLogout = function handleLogout(e) {
13312
13903
  if (typeof GCN !== 'undefined' && GCN && GCN.onecount) {
13313
- GCN.onecount.logout();
13314
- setLoginState(GCN.onecount.isLoggedIn());
13904
+ GCN.onecount.logout().then(function (result) {
13905
+ console.log('logout result:', result);
13906
+ setLoginState(GCN.onecount.isLoggedIn());
13907
+ }).catch(function (error) {
13908
+ console.log('logout error:', error);
13909
+ setLoginState(GCN.onecount.isLoggedIn());
13910
+ });
13315
13911
  } else {
13316
13912
  console.error('GCN not defined');
13317
13913
  }
@@ -13329,9 +13925,9 @@ var NavMagazine = function NavMagazine(props) {
13329
13925
  React__default.createElement(
13330
13926
  Nav,
13331
13927
  { id: 'navbar-top', className: 'justify-content-center navbar-top', style: { margin: '0 auto' } },
13332
- showLogin && !loginState && React__default.createElement(
13928
+ showLogin && React__default.createElement(
13333
13929
  Nav.Item,
13334
- { id: 'nav-mobile-register' },
13930
+ { id: 'nav-mobile-register', className: 'logged-out', style: { display: loginState ? 'none' : '' } },
13335
13931
  React__default.createElement(
13336
13932
  'div',
13337
13933
  { className: 'px-2 py-2', onClick: function onClick(e) {
@@ -13354,9 +13950,9 @@ var NavMagazine = function NavMagazine(props) {
13354
13950
  )
13355
13951
  )
13356
13952
  ),
13357
- showLogin && !loginState && React__default.createElement(
13953
+ showLogin && React__default.createElement(
13358
13954
  Nav.Item,
13359
- { id: 'nav-mobile-login' },
13955
+ { id: 'nav-mobile-login', className: 'logged-out', style: { display: loginState ? 'none' : '' } },
13360
13956
  React__default.createElement(
13361
13957
  'div',
13362
13958
  { className: 'px-2 py-2 ', onClick: function onClick(e) {
@@ -13366,9 +13962,9 @@ var NavMagazine = function NavMagazine(props) {
13366
13962
  ' Login'
13367
13963
  )
13368
13964
  ),
13369
- showLogin && loginState && React__default.createElement(
13965
+ showLogin && React__default.createElement(
13370
13966
  React__default.Fragment,
13371
- null,
13967
+ { className: 'logged-in', style: { display: !loginState ? 'none' : '' } },
13372
13968
  React__default.createElement(
13373
13969
  Nav.Item,
13374
13970
  { id: 'nav-mobile-logout' },
@@ -13386,9 +13982,9 @@ var NavMagazine = function NavMagazine(props) {
13386
13982
  React__default.createElement(
13387
13983
  Nav,
13388
13984
  { style: { position: 'absolute', right: '15px' }, className: 'justify-content-end rightHeader' },
13389
- showLogin && !loginState && React__default.createElement(
13985
+ showLogin && React__default.createElement(
13390
13986
  React__default.Fragment,
13391
- null,
13987
+ { className: 'logged-out', style: { display: loginState ? 'none' : '' } },
13392
13988
  React__default.createElement(
13393
13989
  Nav.Item,
13394
13990
  null,
@@ -13414,9 +14010,9 @@ var NavMagazine = function NavMagazine(props) {
13414
14010
  )
13415
14011
  )
13416
14012
  ),
13417
- showLogin && loginState && React__default.createElement(
14013
+ showLogin && React__default.createElement(
13418
14014
  React__default.Fragment,
13419
- null,
14015
+ { className: 'logged-in', style: { display: !loginState ? 'none' : '' } },
13420
14016
  React__default.createElement(
13421
14017
  Nav.Item,
13422
14018
  null,
@@ -13558,6 +14154,12 @@ var NavMagazine = function NavMagazine(props) {
13558
14154
  );
13559
14155
  };
13560
14156
 
14157
+ NavMagazine.getInitialProps = function (ctx) {
14158
+ return {
14159
+ allCookies: nextCookies_1(ctx)
14160
+ };
14161
+ };
14162
+
13561
14163
  var NavNative = function NavNative(props) {
13562
14164
  var logo = props.logo,
13563
14165
  dataObject = props.dataObject,
@@ -14051,19 +14653,17 @@ var AD = function AD(_ref) {
14051
14653
  _ref$targeting = _ref.targeting,
14052
14654
  targeting = _ref$targeting === undefined ? {} : _ref$targeting;
14053
14655
 
14054
-
14055
14656
  return React__default.createElement(
14056
14657
  lib_1,
14057
- { dfpNetworkId: networkID, targetingArguments: targeting, sizeMapping: sizeMapping, lazyLoad: { fetchMarginPercent: 500, renderMarginPercent: 200, mobileScaling: 2.0 } },
14658
+ {
14659
+ dfpNetworkId: networkID,
14660
+ targetingArguments: targeting,
14661
+ sizeMapping: sizeMapping,
14662
+ lazyLoad: { fetchMarginPercent: 500, renderMarginPercent: 200, mobileScaling: 2.0 } },
14058
14663
  React__default.createElement(
14059
14664
  'div',
14060
14665
  { className: className },
14061
- React__default.createElement(lib_2, {
14062
- slotId: slotId,
14063
- sizes: sizes,
14064
- adUnit: adUnit,
14065
- sizeMapping: sizeMapping
14066
- })
14666
+ React__default.createElement(lib_2, { slotId: slotId, sizes: sizes, adUnit: adUnit, sizeMapping: sizeMapping })
14067
14667
  )
14068
14668
  );
14069
14669
  };
@@ -14100,6 +14700,37 @@ var AD300x250x600 = function AD300x250x600(_ref) {
14100
14700
  });
14101
14701
  };
14102
14702
 
14703
+ var ADFooter = function ADFooter(_ref) {
14704
+ var children = _ref.children;
14705
+
14706
+ var _useState = useState(true),
14707
+ _useState2 = slicedToArray(_useState, 2),
14708
+ showAd = _useState2[0],
14709
+ setShowAd = _useState2[1];
14710
+
14711
+ return React__default.createElement(
14712
+ React__default.Fragment,
14713
+ null,
14714
+ showAd && React__default.createElement(
14715
+ 'div',
14716
+ { className: 'ADFooter' },
14717
+ children,
14718
+ React__default.createElement(
14719
+ 'div',
14720
+ { className: 'closeButton', onClick: function onClick() {
14721
+ return setShowAd(false);
14722
+ } },
14723
+ 'x'
14724
+ )
14725
+ ),
14726
+ React__default.createElement(
14727
+ 'style',
14728
+ { jsx: true },
14729
+ '\n .ADFooter {\n width: auto;\n margin: 0;\n background-color: #f5f5f5;\n position: fixed;\n bottom: 0;\n left: 50%;\n transform: translateX(-50%);\n z-index: 9000;\n }\n .closeButton {\n position: absolute;\n top: -10px;\n right: -10px;\n background: grey;\n color: white;\n font-weight: 500;\n border: 2px solid white;\n border-radius: 50%;\n width: 30px;\n height: 30px;\n text-align: center;\n font-size: 17px;\n cursor: pointer;\n }\n '
14730
+ )
14731
+ );
14732
+ };
14733
+
14103
14734
  var urlFor$1 = function urlFor(source, client) {
14104
14735
  var builder = imageUrlBuilder(client);
14105
14736
  return builder.image(source);
@@ -14502,7 +15133,7 @@ var ms = function(val, options) {
14502
15133
  options = options || {};
14503
15134
  var type = typeof val;
14504
15135
  if (type === 'string' && val.length > 0) {
14505
- return parse(val);
15136
+ return parse$1(val);
14506
15137
  } else if (type === 'number' && isNaN(val) === false) {
14507
15138
  return options.long ? fmtLong(val) : fmtShort(val);
14508
15139
  }
@@ -14520,7 +15151,7 @@ var ms = function(val, options) {
14520
15151
  * @api private
14521
15152
  */
14522
15153
 
14523
- function parse(str) {
15154
+ function parse$1(str) {
14524
15155
  str = String(str);
14525
15156
  if (str.length > 100) {
14526
15157
  return;
@@ -16935,7 +17566,7 @@ function shouldUseNative() {
16935
17566
  }
16936
17567
  }
16937
17568
 
16938
- var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
17569
+ var objectAssign$1 = shouldUseNative() ? Object.assign : function (target, source) {
16939
17570
  var from;
16940
17571
  var to = toObject(target);
16941
17572
  var symbols;
@@ -17010,7 +17641,7 @@ var buildUrl = function buildUrl(props) {
17010
17641
  throw new Error('Invalid image reference in block, no `_ref` found on `asset`');
17011
17642
  }
17012
17643
 
17013
- return node(objectAssign({
17644
+ return node(objectAssign$1({
17014
17645
  projectId: projectId,
17015
17646
  dataset: dataset
17016
17647
  }, options.imageOptions || {})).image(node$$1).toString();
@@ -17150,7 +17781,7 @@ var serializers = function (h, serializerOpts) {
17150
17781
  };
17151
17782
  }
17152
17783
 
17153
- var serializedNode = objectAssign({}, span, children);
17784
+ var serializedNode = objectAssign$1({}, span, children);
17154
17785
  return h(serializers.span, {
17155
17786
  key: span._key || "span-".concat(index),
17156
17787
  node: serializedNode,
@@ -17388,7 +18019,7 @@ function nestLists(blocks) {
17388
18019
  // will mutate the input, and we don't want to blindly clone the entire tree.
17389
18020
  // Clone the last child while adding our new list as the last child of it
17390
18021
  var lastListItem = lastChild(currentList);
17391
- var newLastChild = objectAssign({}, lastListItem, {
18022
+ var newLastChild = objectAssign$1({}, lastListItem, {
17392
18023
  children: lastListItem.children.concat(newList)
17393
18024
  }); // Swap the last child
17394
18025
 
@@ -17490,7 +18121,7 @@ var generateKeys = function (blocks) {
17490
18121
  return block;
17491
18122
  }
17492
18123
 
17493
- return objectAssign({
18124
+ return objectAssign$1({
17494
18125
  _key: getStaticKey(block)
17495
18126
  }, block);
17496
18127
  });
@@ -17534,7 +18165,7 @@ var mergeSerializers = function mergeSerializers(defaultSerializers, userSeriali
17534
18165
  if (type === 'function') {
17535
18166
  acc[key] = isDefined(userSerializers[key]) ? userSerializers[key] : defaultSerializers[key];
17536
18167
  } else if (type === 'object') {
17537
- acc[key] = objectAssign({}, defaultSerializers[key], userSerializers[key]);
18168
+ acc[key] = objectAssign$1({}, defaultSerializers[key], userSerializers[key]);
17538
18169
  } else {
17539
18170
  acc[key] = typeof userSerializers[key] === 'undefined' ? defaultSerializers[key] : userSerializers[key];
17540
18171
  }
@@ -17557,7 +18188,7 @@ var defaults$1 = {
17557
18188
  };
17558
18189
 
17559
18190
  function blocksToNodes(h, properties, defaultSerializers, serializeSpan) {
17560
- var props = objectAssign({}, defaults$1, properties);
18191
+ var props = objectAssign$1({}, defaults$1, properties);
17561
18192
  var rawBlocks = Array.isArray(props.blocks) ? props.blocks : [props.blocks];
17562
18193
  var keyedBlocks = generateKeys(rawBlocks);
17563
18194
  var blocks = nestLists_1(keyedBlocks, props.listNestMode);
@@ -17894,7 +18525,7 @@ var IFrame = function IFrame(_ref) {
17894
18525
  return React__default.createElement(
17895
18526
  'div',
17896
18527
  { className: 'd-block text-center mb-3' },
17897
- React__default.createElement('iframe', { className: 'w-100', src: url, frameBorder: '0' })
18528
+ React__default.createElement('iframe', { className: 'w-100 iFrame-block', src: url, frameBorder: '0' })
17898
18529
  );
17899
18530
  };
17900
18531
 
@@ -18041,7 +18672,7 @@ function removeEventListener(type, listener) {
18041
18672
  }
18042
18673
  }
18043
18674
 
18044
- var serialize = serializeNode;
18675
+ var serialize$1 = serializeNode;
18045
18676
 
18046
18677
  var voidElements = ["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];
18047
18678
 
@@ -18343,7 +18974,7 @@ DOMElement.prototype.focus = function _Element_focus() {
18343
18974
  };
18344
18975
 
18345
18976
  DOMElement.prototype.toString = function _Element_toString() {
18346
- return serialize(this)
18977
+ return serialize$1(this)
18347
18978
  };
18348
18979
 
18349
18980
  DOMElement.prototype.getElementsByClassName = function _Element_getElementsByClassName(classNames) {
@@ -20519,7 +21150,17 @@ var Quiz = function Quiz(_ref) {
20519
21150
  );
20520
21151
  };
20521
21152
 
20522
- var getSerializers$1 = function getSerializers(client, pageview, videoAccountIDs, onVote, showVotes) {
21153
+ var Leads = function Leads(_ref) {
21154
+ var url = _ref.url;
21155
+
21156
+ return React__default.createElement(
21157
+ 'div',
21158
+ { className: 'd-block text-center mb-3' },
21159
+ url && React__default.createElement('iframe', { className: 'w-100 h-100 leads-block', src: url, frameBorder: '0', allow: 'fullscreen' })
21160
+ );
21161
+ };
21162
+
21163
+ var getSerializers$1 = function getSerializers(client, pageview, videoAccountIDs, onVote, showVotes, drupalLeadSettings) {
20523
21164
  return {
20524
21165
  types: {
20525
21166
  youtube: function youtube(_ref) {
@@ -20591,6 +21232,13 @@ var getSerializers$1 = function getSerializers(client, pageview, videoAccountIDs
20591
21232
  var quizzes = node.quizzes;
20592
21233
 
20593
21234
  return React__default.createElement(Quiz, { quizzes: quizzes });
21235
+ },
21236
+ leads: function leads(_ref13) {
21237
+ var node = _ref13.node;
21238
+ var leadID = node.leadID;
21239
+
21240
+ var url = '' + drupalLeadSettings.baseUrl + leadID;
21241
+ return React__default.createElement(Leads, { url: url });
20594
21242
  }
20595
21243
  },
20596
21244
  marks: {
@@ -20620,32 +21268,32 @@ var getSerializers$1 = function getSerializers(client, pageview, videoAccountIDs
20620
21268
  children
20621
21269
  );
20622
21270
  },
20623
- alignleft: function alignleft(_ref13) {
20624
- var children = _ref13.children;
21271
+ alignleft: function alignleft(_ref14) {
21272
+ var children = _ref14.children;
20625
21273
  return React__default.createElement(
20626
21274
  'div',
20627
21275
  { style: { textAlign: 'left' } },
20628
21276
  children
20629
21277
  );
20630
21278
  },
20631
- alignright: function alignright(_ref14) {
20632
- var children = _ref14.children;
21279
+ alignright: function alignright(_ref15) {
21280
+ var children = _ref15.children;
20633
21281
  return React__default.createElement(
20634
21282
  'div',
20635
21283
  { style: { textAlign: 'right' } },
20636
21284
  children
20637
21285
  );
20638
21286
  },
20639
- aligncenter: function aligncenter(_ref15) {
20640
- var children = _ref15.children;
21287
+ aligncenter: function aligncenter(_ref16) {
21288
+ var children = _ref16.children;
20641
21289
  return React__default.createElement(
20642
21290
  'div',
20643
21291
  { style: { textAlign: 'center' } },
20644
21292
  children
20645
21293
  );
20646
21294
  },
20647
- alignjustify: function alignjustify(_ref16) {
20648
- var children = _ref16.children;
21295
+ alignjustify: function alignjustify(_ref17) {
21296
+ var children = _ref17.children;
20649
21297
  return React__default.createElement(
20650
21298
  'div',
20651
21299
  { style: { textAlign: 'justify' } },
@@ -21165,5 +21813,5 @@ var PdfDownload = function PdfDownload(props) {
21165
21813
  );
21166
21814
  };
21167
21815
 
21168
- export { ContentCard as DeckContent, GridContent$1 as GridContent, Queue as DeckQueue, ThumbnailCard, TaxonomyCard, GroupDeck, YoutubeGroup, QueueDeckExpanded, VideoSeriesListing$1 as VideoSeriesListing, Column1, Column2, Column3, Header, LeftNav, AccordionPanel, SocialShare, PageFilter, NavMagazine, NavNative, NavNormal, NavDvm, TemplateNormal, AD300x250, AD300x250x600, AD728x90, getSerializers$1 as getSerializers, Search, Feature, Breadcrumbs, SetCookie, Hero, AlphabeticList, PdfDownload };
21816
+ export { ContentCard as DeckContent, GridContent$1 as GridContent, Queue as DeckQueue, ThumbnailCard, TaxonomyCard, GroupDeck, YoutubeGroup, QueueDeckExpanded, VideoSeriesListing$1 as VideoSeriesListing, PublicationDeck, IssueDeck, IssueContentDeck, Column1, Column2, Column3, Header, LeftNav, AccordionPanel, SocialShare, PageFilter, NavMagazine, NavNative, NavNormal, NavDvm, TemplateNormal, AD, AD300x250, AD300x250x600, AD728x90, ADFooter, getSerializers$1 as getSerializers, Search, Feature, Breadcrumbs, SetCookie, Hero, AlphabeticList, PdfDownload };
21169
21817
  //# sourceMappingURL=index.es.js.map