@mjhls/mjh-framework 1.0.884 → 1.0.885

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 CHANGED
@@ -1,4 +1,4 @@
1
- # mjh-framework v. 1.0.884
1
+ # mjh-framework v. 1.0.885
2
2
 
3
3
  [![NPM](https://img.shields.io/npm/v/mjh-framework.svg)](https://www.npmjs.com/package/mjh-framework) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
4
4
 
@@ -0,0 +1,101 @@
1
+ 'use strict';
2
+
3
+ var stringify = require('./stringify-f7a37a8d.js');
4
+ var _extends = require('./extends-7c86182f.js');
5
+ var toConsumableArray = require('./toConsumableArray-d7797c2b.js');
6
+ var React = require('react');
7
+ var urlFor = require('./urlFor.js');
8
+ require('./_commonjsHelpers-06173234.js');
9
+ require('./core.get-iterator-method-5643aa10.js');
10
+ require('./_object-pie-083f2dd6.js');
11
+ require('./_iter-detect-b1df62f0.js');
12
+ require('./slicedToArray-067dd3bc.js');
13
+ require('./web.dom.iterable-d98303e0.js');
14
+ require('./index-d48b231c.js');
15
+
16
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
+
18
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
19
+
20
+ function toPlainText() {
21
+ var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
22
+
23
+ return blocks
24
+ // loop through each block
25
+ .map(function (block) {
26
+ // if it's not a text block with children,
27
+ // return nothing
28
+ if (block._type !== 'block' || !block.children) {
29
+ return '';
30
+ }
31
+ // loop through the children spans, and join the
32
+ // text strings
33
+ return block.children.map(function (child) {
34
+ return child.text;
35
+ }).join('');
36
+ })
37
+ // join the paragraphs leaving split by two linebreaks
38
+ .join('\n\n');
39
+ }
40
+
41
+ function generateSchema(props) {
42
+ var _props$article = props.article,
43
+ title = _props$article.title,
44
+ body = _props$article.body,
45
+ summary = _props$article.summary,
46
+ url = _props$article.url,
47
+ content_placement = _props$article.content_placement,
48
+ authorDetails = _props$article.authorDetails,
49
+ thumbnail = _props$article.thumbnail,
50
+ published = _props$article.published,
51
+ _updatedAt = _props$article._updatedAt,
52
+ seoTag = _props$article.seoTag,
53
+ _props$Website = props.Website,
54
+ liveDomain = _props$Website.liveDomain,
55
+ websiteTitle = _props$Website.title,
56
+ logo = _props$Website.logo,
57
+ client = props.client;
58
+
59
+ var authors = authorDetails && authorDetails.length > 0 && authorDetails.reduce(function (result, author) {
60
+ if (author.displayName) return [].concat(toConsumableArray._toConsumableArray(result), [{
61
+ '@type': 'Person',
62
+ name: author.displayName
63
+ }]);else return result;
64
+ }, []);
65
+ var articleSection = content_placement && content_placement.map(function (cp) {
66
+ return cp.name;
67
+ });
68
+ var image = thumbnail && thumbnail.asset && client ? urlFor({ source: thumbnail, client: client }) : liveDomain && logo && 'https://' + liveDomain + logo;
69
+
70
+ if (title && published && _updatedAt) {
71
+ return _extends._extends({
72
+ '@context': 'https://schema.org',
73
+ '@type': 'NewsArticle',
74
+ headline: title,
75
+ datePublished: published,
76
+ dateModified: _updatedAt,
77
+ inLanguage: 'en-US'
78
+ }, image && { image: image }, liveDomain && url && url.current && {
79
+ mainEntityOfPage: {
80
+ '@type': 'WebPage',
81
+ '@id': 'https://' + liveDomain + '/view/' + url.current
82
+ }
83
+ }, websiteTitle && liveDomain && logo && {
84
+ publisher: {
85
+ '@type': 'Organization',
86
+ name: websiteTitle,
87
+ logo: {
88
+ '@type': 'ImageObject',
89
+ url: 'https://' + liveDomain + logo
90
+ }
91
+ }
92
+ }, articleSection && { articleSection: articleSection }, seoTag && seoTag.length > 0 && { keywords: seoTag.join() }, body && body.length > 0 && { articleBody: toPlainText(body) }, summary && { description: summary }, authors && authors.length > 0 && { author: authors });
93
+ }
94
+ return null;
95
+ }
96
+
97
+ var Schema = function Schema(props) {
98
+ return React__default['default'].createElement('script', { type: 'application/ld+json', dangerouslySetInnerHTML: { __html: stringify._JSON$stringify(generateSchema(props)) } });
99
+ };
100
+
101
+ module.exports = Schema;
package/dist/cjs/View.js CHANGED
@@ -28,6 +28,7 @@ var index_esm = require('./index.esm-f27f80d9.js');
28
28
  var styleInject_es = require('./style-inject.es-dcee06b6.js');
29
29
  require('./index-eadd5035.js');
30
30
  var disqusReact = require('disqus-react');
31
+ var Schema = require('./Schema.js');
31
32
  var keys = require('./keys-e982b3fa.js');
32
33
  var index_es = require('./index.es-f3e47207.js');
33
34
  var index = require('./index-fc2f1ca2.js');
@@ -445,87 +446,6 @@ var getSocialShareDisableFlag = function getSocialShareDisableFlag(article) {
445
446
  return showSocialShare;
446
447
  };
447
448
 
448
- function toPlainText() {
449
- var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
450
-
451
- return blocks
452
- // loop through each block
453
- .map(function (block) {
454
- // if it's not a text block with children,
455
- // return nothing
456
- if (block._type !== 'block' || !block.children) {
457
- return '';
458
- }
459
- // loop through the children spans, and join the
460
- // text strings
461
- return block.children.map(function (child) {
462
- return child.text;
463
- }).join('');
464
- })
465
- // join the paragraphs leaving split by two linebreaks
466
- .join('\n\n');
467
- }
468
-
469
- function generateSchema(props) {
470
- var _props$article = props.article,
471
- title = _props$article.title,
472
- body = _props$article.body,
473
- summary = _props$article.summary,
474
- url = _props$article.url,
475
- content_placement = _props$article.content_placement,
476
- authorDetails = _props$article.authorDetails,
477
- thumbnail = _props$article.thumbnail,
478
- published = _props$article.published,
479
- _updatedAt = _props$article._updatedAt,
480
- seoTag = _props$article.seoTag,
481
- _props$Website = props.Website,
482
- liveDomain = _props$Website.liveDomain,
483
- websiteTitle = _props$Website.title,
484
- logo = _props$Website.logo,
485
- client = props.client;
486
-
487
- var authors = authorDetails && authorDetails.length > 0 && authorDetails.reduce(function (result, author) {
488
- if (author.displayName) return [].concat(toConsumableArray._toConsumableArray(result), [{
489
- '@type': 'Person',
490
- name: author.displayName
491
- }]);else return result;
492
- }, []);
493
- var articleSection = content_placement && content_placement.map(function (cp) {
494
- return cp.name;
495
- });
496
- var image = thumbnail && thumbnail.asset && client ? urlFor({ source: thumbnail, client: client }) : liveDomain && logo && 'https://' + liveDomain + logo;
497
-
498
- if (title && published && _updatedAt) {
499
- return _extends._extends({
500
- '@context': 'https://schema.org',
501
- '@type': 'NewsArticle',
502
- headline: title,
503
- datePublished: published,
504
- dateModified: _updatedAt,
505
- inLanguage: 'en-US'
506
- }, image && { image: image }, liveDomain && url && url.current && {
507
- mainEntityOfPage: {
508
- '@type': 'WebPage',
509
- '@id': 'https://' + liveDomain + '/view/' + url.current
510
- }
511
- }, websiteTitle && liveDomain && logo && {
512
- publisher: {
513
- '@type': 'Organization',
514
- name: websiteTitle,
515
- logo: {
516
- '@type': 'ImageObject',
517
- url: 'https://' + liveDomain + logo
518
- }
519
- }
520
- }, articleSection && { articleSection: articleSection }, seoTag && seoTag.length > 0 && { keywords: seoTag.join() }, body && body.length > 0 && { articleBody: toPlainText(body) }, summary && { description: summary }, authors && authors.length > 0 && { author: authors });
521
- }
522
- return null;
523
- }
524
-
525
- var Schema = function Schema(props) {
526
- return React__default['default'].createElement('script', { type: 'application/ld+json', dangerouslySetInnerHTML: { __html: stringify._JSON$stringify(generateSchema(props)) } });
527
- };
528
-
529
449
  var Article = React.forwardRef(function (props, ref) {
530
450
  var onVote = function () {
531
451
  var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(nodeKey, selectedChoice) {
package/dist/cjs/index.js CHANGED
@@ -96,6 +96,7 @@ var VideoProgramLandingPage = require('./VideoProgramLandingPage.js');
96
96
  var VideoSeriesLandingPage = require('./VideoSeriesLandingPage.js');
97
97
  var ArticleProgramLandingPage = require('./ArticleProgramLandingPage.js');
98
98
  var ArticleSeriesLandingPage = require('./ArticleSeriesLandingPage.js');
99
+ var Schema = require('./Schema.js');
99
100
  var getTargeting = require('./getTargeting-9d509319.js');
100
101
  var getKeywords = require('./getKeywords.js');
101
102
  var getQuery = require('./getQuery.js');
@@ -370,6 +371,7 @@ exports.VideoProgramLandingPage = VideoProgramLandingPage;
370
371
  exports.VideoSeriesLandingPage = VideoSeriesLandingPage;
371
372
  exports.ArticleProgramLandingPage = ArticleProgramLandingPage;
372
373
  exports.ArticleSeriesLandingPage = ArticleSeriesLandingPage;
374
+ exports.Schema = Schema;
373
375
  exports.getTargeting = getTargeting.getTargeting;
374
376
  exports.getKeywords = getKeywords;
375
377
  exports.getQuery = getQuery;
@@ -0,0 +1,95 @@
1
+ import { _ as _JSON$stringify } from './stringify-2b084bee.js';
2
+ import { _ as _extends } from './extends-6d8e3924.js';
3
+ import { _ as _toConsumableArray } from './toConsumableArray-f7074d7c.js';
4
+ import React__default from 'react';
5
+ import urlFor from './urlFor.js';
6
+ import './_commonjsHelpers-0c4b6f40.js';
7
+ import './core.get-iterator-method-ea258bb1.js';
8
+ import './_object-pie-133f504a.js';
9
+ import './_iter-detect-98db3b07.js';
10
+ import './slicedToArray-6ebcbfea.js';
11
+ import './web.dom.iterable-ab4dea5c.js';
12
+ import './index-3f5c03b2.js';
13
+
14
+ function toPlainText() {
15
+ var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
16
+
17
+ return blocks
18
+ // loop through each block
19
+ .map(function (block) {
20
+ // if it's not a text block with children,
21
+ // return nothing
22
+ if (block._type !== 'block' || !block.children) {
23
+ return '';
24
+ }
25
+ // loop through the children spans, and join the
26
+ // text strings
27
+ return block.children.map(function (child) {
28
+ return child.text;
29
+ }).join('');
30
+ })
31
+ // join the paragraphs leaving split by two linebreaks
32
+ .join('\n\n');
33
+ }
34
+
35
+ function generateSchema(props) {
36
+ var _props$article = props.article,
37
+ title = _props$article.title,
38
+ body = _props$article.body,
39
+ summary = _props$article.summary,
40
+ url = _props$article.url,
41
+ content_placement = _props$article.content_placement,
42
+ authorDetails = _props$article.authorDetails,
43
+ thumbnail = _props$article.thumbnail,
44
+ published = _props$article.published,
45
+ _updatedAt = _props$article._updatedAt,
46
+ seoTag = _props$article.seoTag,
47
+ _props$Website = props.Website,
48
+ liveDomain = _props$Website.liveDomain,
49
+ websiteTitle = _props$Website.title,
50
+ logo = _props$Website.logo,
51
+ client = props.client;
52
+
53
+ var authors = authorDetails && authorDetails.length > 0 && authorDetails.reduce(function (result, author) {
54
+ if (author.displayName) return [].concat(_toConsumableArray(result), [{
55
+ '@type': 'Person',
56
+ name: author.displayName
57
+ }]);else return result;
58
+ }, []);
59
+ var articleSection = content_placement && content_placement.map(function (cp) {
60
+ return cp.name;
61
+ });
62
+ var image = thumbnail && thumbnail.asset && client ? urlFor({ source: thumbnail, client: client }) : liveDomain && logo && 'https://' + liveDomain + logo;
63
+
64
+ if (title && published && _updatedAt) {
65
+ return _extends({
66
+ '@context': 'https://schema.org',
67
+ '@type': 'NewsArticle',
68
+ headline: title,
69
+ datePublished: published,
70
+ dateModified: _updatedAt,
71
+ inLanguage: 'en-US'
72
+ }, image && { image: image }, liveDomain && url && url.current && {
73
+ mainEntityOfPage: {
74
+ '@type': 'WebPage',
75
+ '@id': 'https://' + liveDomain + '/view/' + url.current
76
+ }
77
+ }, websiteTitle && liveDomain && logo && {
78
+ publisher: {
79
+ '@type': 'Organization',
80
+ name: websiteTitle,
81
+ logo: {
82
+ '@type': 'ImageObject',
83
+ url: 'https://' + liveDomain + logo
84
+ }
85
+ }
86
+ }, articleSection && { articleSection: articleSection }, seoTag && seoTag.length > 0 && { keywords: seoTag.join() }, body && body.length > 0 && { articleBody: toPlainText(body) }, summary && { description: summary }, authors && authors.length > 0 && { author: authors });
87
+ }
88
+ return null;
89
+ }
90
+
91
+ var Schema = function Schema(props) {
92
+ return React__default.createElement('script', { type: 'application/ld+json', dangerouslySetInnerHTML: { __html: _JSON$stringify(generateSchema(props)) } });
93
+ };
94
+
95
+ export default Schema;
package/dist/esm/View.js CHANGED
@@ -26,6 +26,7 @@ import { b as FaMinus, c as FaPlus } from './index.esm-d4932dea.js';
26
26
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
27
27
  import './index-755f2cc2.js';
28
28
  import { DiscussionEmbed } from 'disqus-react';
29
+ import Schema from './Schema.js';
29
30
  import { _ as _Object$keys } from './keys-31dcdb31.js';
30
31
  import { I as InfiniteScroll } from './index.es-a6137319.js';
31
32
  import { l as lib_3 } from './index-f0fc23eb.js';
@@ -435,87 +436,6 @@ var getSocialShareDisableFlag = function getSocialShareDisableFlag(article) {
435
436
  return showSocialShare;
436
437
  };
437
438
 
438
- function toPlainText() {
439
- var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
440
-
441
- return blocks
442
- // loop through each block
443
- .map(function (block) {
444
- // if it's not a text block with children,
445
- // return nothing
446
- if (block._type !== 'block' || !block.children) {
447
- return '';
448
- }
449
- // loop through the children spans, and join the
450
- // text strings
451
- return block.children.map(function (child) {
452
- return child.text;
453
- }).join('');
454
- })
455
- // join the paragraphs leaving split by two linebreaks
456
- .join('\n\n');
457
- }
458
-
459
- function generateSchema(props) {
460
- var _props$article = props.article,
461
- title = _props$article.title,
462
- body = _props$article.body,
463
- summary = _props$article.summary,
464
- url = _props$article.url,
465
- content_placement = _props$article.content_placement,
466
- authorDetails = _props$article.authorDetails,
467
- thumbnail = _props$article.thumbnail,
468
- published = _props$article.published,
469
- _updatedAt = _props$article._updatedAt,
470
- seoTag = _props$article.seoTag,
471
- _props$Website = props.Website,
472
- liveDomain = _props$Website.liveDomain,
473
- websiteTitle = _props$Website.title,
474
- logo = _props$Website.logo,
475
- client = props.client;
476
-
477
- var authors = authorDetails && authorDetails.length > 0 && authorDetails.reduce(function (result, author) {
478
- if (author.displayName) return [].concat(_toConsumableArray(result), [{
479
- '@type': 'Person',
480
- name: author.displayName
481
- }]);else return result;
482
- }, []);
483
- var articleSection = content_placement && content_placement.map(function (cp) {
484
- return cp.name;
485
- });
486
- var image = thumbnail && thumbnail.asset && client ? urlFor({ source: thumbnail, client: client }) : liveDomain && logo && 'https://' + liveDomain + logo;
487
-
488
- if (title && published && _updatedAt) {
489
- return _extends({
490
- '@context': 'https://schema.org',
491
- '@type': 'NewsArticle',
492
- headline: title,
493
- datePublished: published,
494
- dateModified: _updatedAt,
495
- inLanguage: 'en-US'
496
- }, image && { image: image }, liveDomain && url && url.current && {
497
- mainEntityOfPage: {
498
- '@type': 'WebPage',
499
- '@id': 'https://' + liveDomain + '/view/' + url.current
500
- }
501
- }, websiteTitle && liveDomain && logo && {
502
- publisher: {
503
- '@type': 'Organization',
504
- name: websiteTitle,
505
- logo: {
506
- '@type': 'ImageObject',
507
- url: 'https://' + liveDomain + logo
508
- }
509
- }
510
- }, articleSection && { articleSection: articleSection }, seoTag && seoTag.length > 0 && { keywords: seoTag.join() }, body && body.length > 0 && { articleBody: toPlainText(body) }, summary && { description: summary }, authors && authors.length > 0 && { author: authors });
511
- }
512
- return null;
513
- }
514
-
515
- var Schema = function Schema(props) {
516
- return React__default.createElement('script', { type: 'application/ld+json', dangerouslySetInnerHTML: { __html: _JSON$stringify(generateSchema(props)) } });
517
- };
518
-
519
439
  var Article = forwardRef(function (props, ref) {
520
440
  var onVote = function () {
521
441
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(nodeKey, selectedChoice) {
package/dist/esm/index.js CHANGED
@@ -93,6 +93,7 @@ export { default as VideoProgramLandingPage } from './VideoProgramLandingPage.js
93
93
  export { default as VideoSeriesLandingPage } from './VideoSeriesLandingPage.js';
94
94
  export { default as ArticleProgramLandingPage } from './ArticleProgramLandingPage.js';
95
95
  export { default as ArticleSeriesLandingPage } from './ArticleSeriesLandingPage.js';
96
+ export { default as Schema } from './Schema.js';
96
97
  export { g as getTargeting } from './getTargeting-4061f839.js';
97
98
  export { default as getKeywords } from './getKeywords.js';
98
99
  export { default as getQuery } from './getQuery.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.884",
3
+ "version": "1.0.885",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",