axyseo 2.0.0-alpha.0.0.26 → 2.0.0-alpha.0.0.28

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.
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _polaris = require("@shopify/polaris");
9
+ require("./RelatedKeywordsDescription.scss");
10
+ const RelatedKeywordDescription = ({
11
+ words,
12
+ i18n
13
+ }) => {
14
+ const [viewMore, setViewMore] = (0, _react.useState)(false);
15
+ const arr = (0, _react.useMemo)(() => {
16
+ if (words) {
17
+ const wordsArr = Object.keys(words);
18
+ return wordsArr?.length > 2 && !viewMore ? wordsArr.slice(0, 2) : wordsArr;
19
+ }
20
+ return [];
21
+ }, [words, viewMore]);
22
+ return /*#__PURE__*/React.createElement("div", {
23
+ className: "Avada-Seo-Checklist__Description"
24
+ }, words && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_polaris.BlockStack, {
25
+ gap: "200"
26
+ }, arr.map(key => /*#__PURE__*/React.createElement(_polaris.InlineStack, {
27
+ key: key,
28
+ gap: "200"
29
+ }, /*#__PURE__*/React.createElement(_polaris.Badge, null, key, ":"), /*#__PURE__*/React.createElement(_polaris.Text, {
30
+ as: "span"
31
+ }, words[key].length, " words"), /*#__PURE__*/React.createElement(_polaris.Text, {
32
+ as: "span"
33
+ }, "|"), /*#__PURE__*/React.createElement(_polaris.Text, {
34
+ as: "span"
35
+ }, words[key].percentage, "% used")))), Object.keys(words).length > 2 && /*#__PURE__*/React.createElement("div", {
36
+ className: "Avada-Seo-Checklist__Description-Backdrop"
37
+ }, /*#__PURE__*/React.createElement(_polaris.Button, {
38
+ size: "medium",
39
+ variant: "plain",
40
+ onClick: () => setViewMore(!viewMore)
41
+ }, viewMore ? i18n.translate('Axyseo.Button.viewLess') : i18n.translate('Axyseo.Button.viewMore')))));
42
+ };
43
+ var _default = exports.default = RelatedKeywordDescription;
44
+ //# sourceMappingURL=RelatedKeywordsDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RelatedKeywordsDescription.js","names":["_react","require","_polaris","RelatedKeywordDescription","words","i18n","viewMore","setViewMore","useState","arr","useMemo","wordsArr","Object","keys","length","slice","React","createElement","className","Fragment","BlockStack","gap","map","key","InlineStack","Badge","Text","as","percentage","Button","size","variant","onClick","translate","_default","exports","default"],"sources":["../../src/components/RelatedKeywordsDescription.js"],"sourcesContent":["import {useMemo, useState} from 'react';\nimport {Badge, BlockStack, Button, InlineStack, Text} from '@shopify/polaris';\nimport './RelatedKeywordsDescription.scss';\n\nconst RelatedKeywordDescription = ({words, i18n}) => {\n const [viewMore, setViewMore] = useState(false);\n const arr = useMemo(() => {\n if (words) {\n const wordsArr = Object.keys(words);\n return wordsArr?.length > 2 && !viewMore ? wordsArr.slice(0, 2) : wordsArr;\n }\n return [];\n }, [words, viewMore]);\n\n return (\n <div className=\"Avada-Seo-Checklist__Description\">\n {words && (\n <>\n <BlockStack gap=\"200\">\n {arr.map(key => (\n <InlineStack key={key} gap=\"200\">\n <Badge>{key}:</Badge>\n <Text as=\"span\">{words[key].length} words</Text>\n <Text as=\"span\">|</Text>\n <Text as=\"span\">{words[key].percentage}% used</Text>\n </InlineStack>\n ))}\n </BlockStack>\n {Object.keys(words).length > 2 && (\n <div className=\"Avada-Seo-Checklist__Description-Backdrop\">\n <Button size=\"medium\" variant=\"plain\" onClick={() => setViewMore(!viewMore)}>\n {viewMore\n ? i18n.translate('Axyseo.Button.viewLess')\n : i18n.translate('Axyseo.Button.viewMore')}\n </Button>\n </div>\n )}\n </>\n )}\n </div>\n );\n};\n\nexport default RelatedKeywordDescription;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACAA,OAAA;AAEA,MAAME,yBAAyB,GAAGA,CAAC;EAACC,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AACmB,GAAG,CAAC,CAACK,UAAU,EAAC,QAAY,CACxC,CACd,CACS,CAAC,EACZhB,MAAM,CAACC,IAAI,CAACT,KAAK,CAAC,CAACU,MAAM,GAAG,CAAC,iBAC5BE,KAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA2C,gBACxDF,KAAA,CAAAC,aAAA,CAACf,QAAA,CAAA2B,MAAM;IAACC,IAAI,EAAC,QAAQ;IAACC,OAAO,EAAC,OAAO;IAACC,OAAO,EAAEA,CAAA,KAAMzB,WAAW,CAAC,CAACD,QAAQ;EAAE,GACzEA,QAAQ,GACLD,IAAI,CAAC4B,SAAS,CAAC,wBAAwB,CAAC,GACxC5B,IAAI,CAAC4B,SAAS,CAAC,wBAAwB,CACrC,CACL,CAEP,CAED,CAAC;AAEV,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEajC,yBAAyB","ignoreList":[]}
@@ -0,0 +1,34 @@
1
+ .Avada-Seo-Checklist__Description {
2
+ line-height: 16px;
3
+ color: #6d7175;
4
+ position: relative;
5
+ transition: all 0.25s ease-in;
6
+
7
+ a {
8
+ text-decoration: unset;
9
+ }
10
+
11
+ &:has(.Avada-Seo-Checklist__DescriptionBody-expanded) {
12
+ transition: all 0.25s ease-out;
13
+ }
14
+
15
+ .Avada-Seo-Checklist__DescriptionBody-collapsed {
16
+ overflow: hidden;
17
+ text-overflow: ellipsis;
18
+ display: -webkit-box;
19
+ -webkit-line-clamp: 2;
20
+ -webkit-box-orient: vertical;
21
+
22
+ > p {
23
+ overflow: hidden;
24
+ text-overflow: ellipsis;
25
+ display: -webkit-box;
26
+ -webkit-line-clamp: 2;
27
+ -webkit-box-orient: vertical;
28
+ }
29
+ }
30
+
31
+ .Avada-Seo-Checklist__Description-Backdrop {
32
+ float: right;
33
+ }
34
+ }
@@ -16,5 +16,5 @@ const statusRate = exports.statusRate = {
16
16
  bad: 0
17
17
  };
18
18
  const technicalSEOCategory = exports.technicalSEOCategory = ['singleH1', 'metaDescriptionLength', 'urlLength', 'internalLinks', 'externalLinks', 'titleWidth', 'textImages', 'schema', 'singleTitle'];
19
- const contentSEOCategory = exports.contentSEOCategory = ['introductionKeyword', 'sentenceBeginnings', 'textSentenceLength', 'textLength', 'titleKeyword', 'keyphraseLength', 'textTransitionWords', 'keyphraseDensity', 'slugKeyword', 'keyphrase', 'textParagraphTooLong', 'subheadingsKeyword', 'images', 'numberTitle', 'metaDescriptionKeyword'];
19
+ const contentSEOCategory = exports.contentSEOCategory = ['introductionKeyword', 'sentenceBeginnings', 'textSentenceLength', 'textLength', 'titleKeyword', 'keyphraseLength', 'textTransitionWords', 'keyphraseDensity', 'slugKeyword', 'keyphrase', 'textParagraphTooLong', 'subheadingsKeyword', 'images', 'numberTitle', 'metaDescriptionKeyword', 'relatedKeyword'];
20
20
  //# sourceMappingURL=analysis.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"analysis.js","names":["POINT","exports","priorityRate","high","medium","low","statusRate","good","improve","bad","technicalSEOCategory","contentSEOCategory"],"sources":["../../src/const/analysis.js"],"sourcesContent":["export const POINT = 100;\nexport const priorityRate = {\n high: 1,\n medium: 0.75,\n low: 0.5\n};\nexport const statusRate = {\n good: 1,\n improve: 0.5,\n bad: 0\n};\n\nexport const technicalSEOCategory = [\n 'singleH1',\n 'metaDescriptionLength',\n 'urlLength',\n 'internalLinks',\n 'externalLinks',\n 'titleWidth',\n 'textImages',\n 'schema',\n 'singleTitle'\n];\n\nexport const contentSEOCategory = [\n 'introductionKeyword',\n 'sentenceBeginnings',\n 'textSentenceLength',\n 'textLength',\n 'titleKeyword',\n 'keyphraseLength',\n 'textTransitionWords',\n 'keyphraseDensity',\n 'slugKeyword',\n 'keyphrase',\n 'textParagraphTooLong',\n 'subheadingsKeyword',\n 'images',\n 'numberTitle',\n 'metaDescriptionKeyword'\n];\n"],"mappings":";;;;;;AAAO,MAAMA,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG,GAAG;AACjB,MAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG;EAC1BC,IAAI,EAAE,CAAC;EACPC,MAAM,EAAE,IAAI;EACZC,GAAG,EAAE;AACP,CAAC;AACM,MAAMC,UAAU,GAAAL,OAAA,CAAAK,UAAA,GAAG;EACxBC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,GAAG;EACZC,GAAG,EAAE;AACP,CAAC;AAEM,MAAMC,oBAAoB,GAAAT,OAAA,CAAAS,oBAAA,GAAG,CAClC,UAAU,EACV,uBAAuB,EACvB,WAAW,EACX,eAAe,EACf,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,aAAa,CACd;AAEM,MAAMC,kBAAkB,GAAAV,OAAA,CAAAU,kBAAA,GAAG,CAChC,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,QAAQ,EACR,aAAa,EACb,wBAAwB,CACzB","ignoreList":[]}
1
+ {"version":3,"file":"analysis.js","names":["POINT","exports","priorityRate","high","medium","low","statusRate","good","improve","bad","technicalSEOCategory","contentSEOCategory"],"sources":["../../src/const/analysis.js"],"sourcesContent":["export const POINT = 100;\nexport const priorityRate = {\n high: 1,\n medium: 0.75,\n low: 0.5\n};\nexport const statusRate = {\n good: 1,\n improve: 0.5,\n bad: 0\n};\n\nexport const technicalSEOCategory = [\n 'singleH1',\n 'metaDescriptionLength',\n 'urlLength',\n 'internalLinks',\n 'externalLinks',\n 'titleWidth',\n 'textImages',\n 'schema',\n 'singleTitle'\n];\n\nexport const contentSEOCategory = [\n 'introductionKeyword',\n 'sentenceBeginnings',\n 'textSentenceLength',\n 'textLength',\n 'titleKeyword',\n 'keyphraseLength',\n 'textTransitionWords',\n 'keyphraseDensity',\n 'slugKeyword',\n 'keyphrase',\n 'textParagraphTooLong',\n 'subheadingsKeyword',\n 'images',\n 'numberTitle',\n 'metaDescriptionKeyword',\n 'relatedKeyword'\n];\n"],"mappings":";;;;;;AAAO,MAAMA,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG,GAAG;AACjB,MAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG;EAC1BC,IAAI,EAAE,CAAC;EACPC,MAAM,EAAE,IAAI;EACZC,GAAG,EAAE;AACP,CAAC;AACM,MAAMC,UAAU,GAAAL,OAAA,CAAAK,UAAA,GAAG;EACxBC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,GAAG;EACZC,GAAG,EAAE;AACP,CAAC;AAEM,MAAMC,oBAAoB,GAAAT,OAAA,CAAAS,oBAAA,GAAG,CAClC,UAAU,EACV,uBAAuB,EACvB,WAAW,EACX,eAAe,EACf,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,aAAa,CACd;AAEM,MAAMC,kBAAkB,GAAAV,OAAA,CAAAU,kBAAA,GAAG,CAChC,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,QAAQ,EACR,aAAa,EACb,wBAAwB,EACxB,gBAAgB,CACjB","ignoreList":[]}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = _default;
7
+ exports.transformRelatedKeyword = void 0;
8
+ /**
9
+ * Checks how many sentences from a text contain at least one transition word or two-part transition word
10
+ * that are defined in the transition words config and two part transition words config.
11
+ *
12
+ * @param {Paper} paper The Paper object to get text from.
13
+ * @param {Researcher} researcher The researcher.
14
+ *
15
+ * @returns {object} An object with the total number of sentences in the text
16
+ * and the total number of sentences containing one or more transition words.
17
+ */
18
+ function _default(paper, researcher) {
19
+ const data = paper.getData();
20
+ const related_keywords = transformRelatedKeyword(data?.related_keywords || []);
21
+ const string = getTextFullPage(data);
22
+ return countWordsInRelatedKeywords({
23
+ related_keywords,
24
+ string
25
+ });
26
+ }
27
+ const transformRelatedKeyword = keywords => keywords.map(keyword => typeof keyword === 'string' ? {
28
+ text: keyword
29
+ } : keyword) || [];
30
+
31
+ /**
32
+ *
33
+ * @param data
34
+ * @returns {string}
35
+ */
36
+ exports.transformRelatedKeyword = transformRelatedKeyword;
37
+ const getTextFullPage = data => {
38
+ const faqString = data.faqs.status ? data.faqs.questions.map(i => i.question + ' ' + i.answer).join(' ') : '';
39
+ const html = data.body_html || data.descriptionHtml;
40
+ const bodyString = html?.length > 0 ? html.replace(/<\/?[^>]+(>|$)/g, ' ') : '';
41
+ return [faqString, data.title, bodyString, data?.metafields_avadaSEO_after_content, data.metafields_global_title_tag, data.metafields_global_description_tag].join(' ').toLowerCase();
42
+ };
43
+
44
+ /**
45
+ *
46
+ * @param related_keywords
47
+ * @param string
48
+ * @returns {{totalWordUsed: number, words: {}, isWordUsedExceeding: boolean}}
49
+ */
50
+ const countWordsInRelatedKeywords = ({
51
+ related_keywords,
52
+ string
53
+ }) => {
54
+ const total = string.split(/\s+/).filter(word => word.length > 0).length;
55
+ const words = {};
56
+ let totalWordUsed = 0;
57
+ let isWordUsedExceeding = false;
58
+ related_keywords.forEach(({
59
+ text
60
+ }) => {
61
+ const keyword = text.toLowerCase();
62
+ const length = (string.match(new RegExp(`\\b${keyword}\\b`, 'g')) || []).length;
63
+ const percentage = parseFloat((length / total * 100).toFixed(1));
64
+ if (!isWordUsedExceeding) {
65
+ isWordUsedExceeding = percentage > 1;
66
+ }
67
+ totalWordUsed += length;
68
+ words[text] = {
69
+ length,
70
+ percentage
71
+ };
72
+ });
73
+ return {
74
+ totalWordUsed,
75
+ words,
76
+ isWordUsedExceeding
77
+ };
78
+ };
79
+ //# sourceMappingURL=checkRelatedKeywords.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkRelatedKeywords.js","names":["_default","paper","researcher","data","getData","related_keywords","transformRelatedKeyword","string","getTextFullPage","countWordsInRelatedKeywords","keywords","map","keyword","text","exports","faqString","faqs","status","questions","i","question","answer","join","html","body_html","descriptionHtml","bodyString","length","replace","title","metafields_avadaSEO_after_content","metafields_global_title_tag","metafields_global_description_tag","toLowerCase","total","split","filter","word","words","totalWordUsed","isWordUsedExceeding","forEach","match","RegExp","percentage","parseFloat","toFixed"],"sources":["../../../src/languageProcessing/researches/checkRelatedKeywords.js"],"sourcesContent":["/**\n * Checks how many sentences from a text contain at least one transition word or two-part transition word\n * that are defined in the transition words config and two part transition words config.\n *\n * @param {Paper} paper The Paper object to get text from.\n * @param {Researcher} researcher The researcher.\n *\n * @returns {object} An object with the total number of sentences in the text\n * and the total number of sentences containing one or more transition words.\n */\nexport default function(paper, researcher) {\n const data = paper.getData();\n const related_keywords = transformRelatedKeyword(data?.related_keywords || []);\n const string = getTextFullPage(data);\n return countWordsInRelatedKeywords({related_keywords, string});\n}\n\nexport const transformRelatedKeyword = keywords =>\n keywords.map(keyword => (typeof keyword === 'string' ? {text: keyword} : keyword)) || [];\n\n/**\n *\n * @param data\n * @returns {string}\n */\nconst getTextFullPage = data => {\n const faqString = data.faqs.status\n ? data.faqs.questions.map(i => i.question + ' ' + i.answer).join(' ')\n : '';\n const html = data.body_html || data.descriptionHtml;\n const bodyString = html?.length > 0 ? html.replace(/<\\/?[^>]+(>|$)/g, ' ') : '';\n return [\n faqString,\n data.title,\n bodyString,\n data?.metafields_avadaSEO_after_content,\n data.metafields_global_title_tag,\n data.metafields_global_description_tag\n ]\n .join(' ')\n .toLowerCase();\n};\n\n/**\n *\n * @param related_keywords\n * @param string\n * @returns {{totalWordUsed: number, words: {}, isWordUsedExceeding: boolean}}\n */\nconst countWordsInRelatedKeywords = ({related_keywords, string}) => {\n const total = string.split(/\\s+/).filter(word => word.length > 0).length;\n const words = {};\n let totalWordUsed = 0;\n let isWordUsedExceeding = false;\n\n related_keywords.forEach(({text}) => {\n const keyword = text.toLowerCase();\n const length = (string.match(new RegExp(`\\\\b${keyword}\\\\b`, 'g')) || []).length;\n const percentage = parseFloat(((length / total) * 100).toFixed(1));\n if (!isWordUsedExceeding) {\n isWordUsedExceeding = percentage > 1;\n }\n totalWordUsed += length;\n words[text] = {length, percentage};\n });\n\n return {totalWordUsed, words, isWordUsedExceeding};\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAAA,SAASC,KAAK,EAAEC,UAAU,EAAE;EACzC,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAAC,CAAC;EAC5B,MAAMC,gBAAgB,GAAGC,uBAAuB,CAACH,IAAI,EAAEE,gBAAgB,IAAI,EAAE,CAAC;EAC9E,MAAME,MAAM,GAAGC,eAAe,CAACL,IAAI,CAAC;EACpC,OAAOM,2BAA2B,CAAC;IAACJ,gBAAgB;IAAEE;EAAM,CAAC,CAAC;AAChE;AAEO,MAAMD,uBAAuB,GAAGI,QAAQ,IAC7CA,QAAQ,CAACC,GAAG,CAACC,OAAO,IAAK,OAAOA,OAAO,KAAK,QAAQ,GAAG;EAACC,IAAI,EAAED;AAAO,CAAC,GAAGA,OAAQ,CAAC,IAAI,EAAE;;AAE1F;AACA;AACA;AACA;AACA;AAJAE,OAAA,CAAAR,uBAAA,GAAAA,uBAAA;AAKA,MAAME,eAAe,GAAGL,IAAI,IAAI;EAC9B,MAAMY,SAAS,GAAGZ,IAAI,CAACa,IAAI,CAACC,MAAM,GAC9Bd,IAAI,CAACa,IAAI,CAACE,SAAS,CAACP,GAAG,CAACQ,CAAC,IAAIA,CAAC,CAACC,QAAQ,GAAG,GAAG,GAAGD,CAAC,CAACE,MAAM,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,GACnE,EAAE;EACN,MAAMC,IAAI,GAAGpB,IAAI,CAACqB,SAAS,IAAIrB,IAAI,CAACsB,eAAe;EACnD,MAAMC,UAAU,GAAGH,IAAI,EA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B;IAAU,CAAC;EACpC,CAAC,CAAC;EAEF,OAAO;IAACL,aAAa;IAAED,KAAK;IAAEE;EAAmB,CAAC;AACpD,CAAC","ignoreList":[]}
@@ -28,6 +28,7 @@ var _NumberInMetaTitleAssessment = _interopRequireDefault(require("./seo/NumberI
28
28
  var _TextImagesAssessment = _interopRequireDefault(require("./seo/TextImagesAssessment"));
29
29
  var _MetaTitleKeywordAssessment = _interopRequireDefault(require("./seo/MetaTitleKeywordAssessment"));
30
30
  var _SchemaAssessment = _interopRequireDefault(require("./seo/SchemaAssessment"));
31
+ var _RelatedKeywordsAssessment = _interopRequireDefault(require("./readability/RelatedKeywordsAssessment"));
31
32
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
32
33
  // Readability assessments.
33
34
 
@@ -61,6 +62,7 @@ const seo = exports.seo = {
61
62
  TextLengthAssessment: _TextLengthAssessment.default,
62
63
  SlugKeywordAssessment: _UrlKeywordAssessment.default,
63
64
  KeyphraseAssessment: _KeyphraseAssessment.default,
64
- SchemaAssessment: _SchemaAssessment.default
65
+ SchemaAssessment: _SchemaAssessment.default,
66
+ RelatedKeywordsAssessment: _RelatedKeywordsAssessment.default
65
67
  };
66
68
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_ParagraphTooLongAssessment","_interopRequireDefault","require","_SentenceBeginningsAssessment","_SentenceLengthInTextAssessment","_TransitionWordsAssessment","_InternalLinksAssessment","_IntroductionKeywordAssessment","_KeyphraseLengthAssessment","_KeywordDensityAssessment","_MetaDescriptionKeywordAssessment","_MetaDescriptionLengthAssessment","_OutboundLinksAssessment","_PageTitleWidthAssessment","_SingleH1Assessment","_SubHeadingsKeywordAssessment","_TextLengthAssessment","_UrlKeywordAssessment","_ImageCountAssessment","_KeyphraseAssessment","_SingleTitleAssessment","_UrlLengthAssessment","_NumberInMetaTitleAssessment","_TextImagesAssessment","_MetaTitleKeywordAssessment","_SchemaAssessment","e","__esModule","default","readability","exports","ParagraphTooLongAssessment","SentenceBeginningsAssessment","SentenceLengthInTextAssessment","TransitionWordsAssessment","seo","ImageCountAssessment","NumberInMetaTitleAssessment","InternalLinksAssessment","TextImagesAssessment","MetaTitleKeywordAssessment","IntroductionKeywordAssessment","SingleTitleAssessment","KeyphraseLengthAssessment","UrlLengthAssessment","KeyphraseDensityAssessment","MetaDescriptionKeywordAssessment","MetaDescriptionLengthAssessment","OutboundLinksAssessment","PageTitleWidthAssessment","SingleH1Assessment","SubheadingsKeywordAssessment","TextLengthAssessment","SlugKeywordAssessment","KeyphraseAssessment","SchemaAssessment"],"sources":["../../../src/scoring/assessments/index.js"],"sourcesContent":["// Readability assessments.\nimport ParagraphTooLongAssessment from './readability/ParagraphTooLongAssessment';\nimport SentenceBeginningsAssessment from './readability/SentenceBeginningsAssessment';\nimport SentenceLengthInTextAssessment from './readability/SentenceLengthInTextAssessment';\nimport TransitionWordsAssessment from './readability/TransitionWordsAssessment';\n\n// SEO assessments.\nimport InternalLinksAssessment from './seo/InternalLinksAssessment';\nimport IntroductionKeywordAssessment from './seo/IntroductionKeywordAssessment';\nimport KeyphraseLengthAssessment from './seo/KeyphraseLengthAssessment';\nimport KeyphraseDensityAssessment from './seo/KeywordDensityAssessment';\nimport MetaDescriptionKeywordAssessment from './seo/MetaDescriptionKeywordAssessment';\nimport MetaDescriptionLengthAssessment from './seo/MetaDescriptionLengthAssessment';\nimport OutboundLinksAssessment from './seo/OutboundLinksAssessment';\nimport PageTitleWidthAssessment from './seo/PageTitleWidthAssessment';\nimport SingleH1Assessment from './seo/SingleH1Assessment';\nimport SubheadingsKeywordAssessment from './seo/SubHeadingsKeywordAssessment';\nimport TextLengthAssessment from './seo/TextLengthAssessment';\nimport SlugKeywordAssessment from './seo/UrlKeywordAssessment';\nimport ImageCountAssessment from './seo/ImageCountAssessment';\nimport KeyphraseAssessment from './seo/KeyphraseAssessment';\nimport SingleTitleAssessment from './seo/SingleTitleAssessment';\nimport UrlLengthAssessment from './seo/UrlLengthAssessment';\nimport NumberInMetaTitleAssessment from './seo/NumberInMetaTitleAssessment';\nimport TextImagesAssessment from './seo/TextImagesAssessment';\nimport MetaTitleKeywordAssessment from './seo/MetaTitleKeywordAssessment';\nimport SchemaAssessment from './seo/SchemaAssessment';\n\nconst readability = {\n ParagraphTooLongAssessment,\n SentenceBeginningsAssessment,\n SentenceLengthInTextAssessment,\n TransitionWordsAssessment\n};\n\n// We expose the deprecated assessments for backwards compatibility.\nconst seo = {\n ImageCountAssessment,\n NumberInMetaTitleAssessment,\n InternalLinksAssessment,\n TextImagesAssessment,\n MetaTitleKeywordAssessment,\n IntroductionKeywordAssessment,\n SingleTitleAssessment,\n KeyphraseLengthAssessment,\n UrlLengthAssessment,\n KeyphraseDensityAssessment,\n MetaDescriptionKeywordAssessment,\n MetaDescriptionLengthAssessment,\n OutboundLinksAssessment,\n PageTitleWidthAssessment,\n SingleH1Assessment,\n SubheadingsKeywordAssessment,\n TextLengthAssessment,\n SlugKeywordAssessment,\n KeyphraseAssessment,\n SchemaAssessment\n};\n\nexport {readability, seo};\n"],"mappings":";;;;;;AACA,IAAAA,2BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,6BAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,+BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,0BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAGA,IAAAI,wBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,8BAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,0BAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,yBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,iCAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,gCAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,wBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,yBAAA,GAAAZ,sB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zBC,mBAAmB,EAAnBA,4BAAmB;EACnBC,0BAA0B,EAA1BA,iCAA0B;EAC1BC,gCAAgC,EAAhCA,yCAAgC;EAChCC,+BAA+B,EAA/BA,wCAA+B;EAC/BC,uBAAuB,EAAvBA,gCAAuB;EACvBC,wBAAwB,EAAxBA,iCAAwB;EACxBC,kBAAkB,EAAlBA,2BAAkB;EAClBC,4BAA4B,EAA5BA,qCAA4B;EAC5BC,oBAAoB,EAApBA,6BAAoB;EACpBC,qBAAqB,EAArBA,6BAAqB;EACrBC,mBAAmB,EAAnBA,4BAAmB;EACnBC,gBAAgB,EAAhBA;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_ParagraphTooLongAssessment","_interopRequireDefault","require","_SentenceBeginningsAssessment","_SentenceLengthInTextAssessment","_TransitionWordsAssessment","_InternalLinksAssessment","_IntroductionKeywordAssessment","_KeyphraseLengthAssessment","_KeywordDensityAssessment","_MetaDescriptionKeywordAssessment","_MetaDescriptionLengthAssessment","_OutboundLinksAssessment","_PageTitleWidthAssessment","_SingleH1Assessment","_SubHeadingsKeywordAssessment","_TextLengthAssessment","_UrlKeywordAssessment","_ImageCountAssessment","_KeyphraseAssessment","_SingleTitleAssessment","_UrlLengthAssessment","_NumberInMetaTitleAssessment","_TextImagesAssessment","_MetaTitleKeywordAssessment","_SchemaAssessment","_RelatedKeywordsAssessment","e","__esModule","default","readability","exports","ParagraphTooLongAssessment","SentenceBeginningsAssessment","SentenceLengthInTextAssessment","TransitionWordsAssessment","seo","ImageCountAssessment","NumberInMetaTitleAssessment","InternalLinksAssessment","TextImagesAssessment","MetaTitleKeywordAssessment","IntroductionKeywordAssessment","SingleTitleAssessment","KeyphraseLengthAssessment","UrlLengthAssessment","KeyphraseDensityAssessment","MetaDescriptionKeywordAssessment","MetaDescriptionLengthAssessment","OutboundLinksAssessment","PageTitleWidthAssessment","SingleH1Assessment","SubheadingsKeywordAssessment","TextLengthAssessment","SlugKeywordAssessment","KeyphraseAssessment","SchemaAssessment","RelatedKeywordsAssessment"],"sources":["../../../src/scoring/assessments/index.js"],"sourcesContent":["// Readability assessments.\nimport ParagraphTooLongAssessment from './readability/ParagraphTooLongAssessment';\nimport SentenceBeginningsAssessment from './readability/SentenceBeginningsAssessment';\nimport SentenceLengthInTextAssessment from './readability/SentenceLengthInTextAssessment';\nimport TransitionWordsAssessment from './readability/TransitionWordsAssessment';\n\n// SEO assessments.\nimport InternalLinksAssessment from './seo/InternalLinksAssessment';\nimport IntroductionKeywordAssessment from './seo/IntroductionKeywordAssessment';\nimport KeyphraseLengthAssessment from './seo/KeyphraseLengthAssessment';\nimport KeyphraseDensityAssessment from './seo/KeywordDensityAssessment';\nimport MetaDescriptionKeywordAssessment from './seo/MetaDescriptionKeywordAssessment';\nimport MetaDescriptionLengthAssessment from './seo/MetaDescriptionLengthAssessment';\nimport OutboundLinksAssessment from './seo/OutboundLinksAssessment';\nimport PageTitleWidthAssessment from './seo/PageTitleWidthAssessment';\nimport SingleH1Assessment from './seo/SingleH1Assessment';\nimport SubheadingsKeywordAssessment from './seo/SubHeadingsKeywordAssessment';\nimport TextLengthAssessment from './seo/TextLengthAssessment';\nimport SlugKeywordAssessment from './seo/UrlKeywordAssessment';\nimport ImageCountAssessment from './seo/ImageCountAssessment';\nimport KeyphraseAssessment from './seo/KeyphraseAssessment';\nimport SingleTitleAssessment from './seo/SingleTitleAssessment';\nimport UrlLengthAssessment from './seo/UrlLengthAssessment';\nimport NumberInMetaTitleAssessment from './seo/NumberInMetaTitleAssessment';\nimport TextImagesAssessment from './seo/TextImagesAssessment';\nimport MetaTitleKeywordAssessment from './seo/MetaTitleKeywordAssessment';\nimport SchemaAssessment from './seo/SchemaAssessment';\nimport RelatedKeywordsAssessment from '@axyseo/scoring/assessments/readability/RelatedKeywordsAssessment';\n\nconst readability = {\n ParagraphTooLongAssessment,\n SentenceBeginningsAssessment,\n SentenceLengthInTextAssessment,\n TransitionWordsAssessment\n};\n\n// We expose the deprecated assessments for backwards compatibility.\nconst seo = {\n ImageCountAssessment,\n NumberInMetaTitleAssessment,\n InternalLinksAssessment,\n TextImagesAssessment,\n MetaTitleKeywordAssessment,\n IntroductionKeywordAssessment,\n SingleTitleAssessment,\n KeyphraseLengthAssessment,\n UrlLengthAssessment,\n KeyphraseDensityAssessment,\n MetaDescriptionKeywordAssessment,\n MetaDescriptionLengthAssessment,\n OutboundLinksAssessment,\n PageTitleWidthAssessment,\n SingleH1Assessment,\n SubheadingsKeywordAssessment,\n TextLengthAssessment,\n SlugKeywordAssessment,\n KeyphraseAssessment,\n SchemaAssessment,\n RelatedKeywordsAssessment\n};\n\nexport {readability, seo};\n"],"mappings":";;;;;;AACA,IAAAA,2BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,6BAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,+BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,0BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAGA,IAAAI,wBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,8BAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,0BAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,yBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,iCAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,gCAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,wBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,yBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,mBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,6BAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,qBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,qBAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,qBAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IA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lBA,2BAAkB;EAClBC,4BAA4B,EAA5BA,qCAA4B;EAC5BC,oBAAoB,EAApBA,6BAAoB;EACpBC,qBAAqB,EAArBA,6BAAqB;EACrBC,mBAAmB,EAAnBA,4BAAmB;EACnBC,gBAAgB,EAAhBA,yBAAgB;EAChBC,yBAAyB,EAAzBA;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _lodash = require("lodash");
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _AssessmentResult = _interopRequireDefault(require("../../../values/AssessmentResult"));
10
+ var _assessment = _interopRequireDefault(require("../assessment"));
11
+ var _RelatedKeywordsDescription = _interopRequireDefault(require("../../../components/RelatedKeywordsDescription"));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ /**
14
+ * Represents the assessment that checks whether there are enough transition words in the text.
15
+ */
16
+ class RelatedKeywordsAssessment extends _assessment.default {
17
+ /**
18
+ * Sets the identifier and the config.
19
+ *
20
+ * @param {object} config The configuration to use.
21
+ *
22
+ * @returns {void}
23
+ */
24
+ constructor(config = {}) {
25
+ super();
26
+ const defaultConfig = {
27
+ id: 'relatedKeywords',
28
+ fixPosition: 'description',
29
+ ctaType: 'fix',
30
+ docUrl: 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#duplicate-title',
31
+ priority: 'high',
32
+ title: 'Related keywords',
33
+ content: {
34
+ good: 'Related keyword density is optimized',
35
+ bad: 'Consider using at least a related keyword in your page to establish topical relevance.',
36
+ improve: 'Too high related keyword density. Keep related keyword density from 0.5% - 1%.'
37
+ }
38
+ };
39
+ this.identifier = 'relatedKeywords';
40
+ this._config = (0, _lodash.merge)(defaultConfig, config);
41
+ }
42
+
43
+ /**
44
+ *
45
+ * @param paper
46
+ * @param relatedKeywords
47
+ * @param i18n
48
+ * @returns {{score: number, body: React.JSX.Element, status: string}}
49
+ */
50
+ calculateResult(paper, relatedKeywords, i18n) {
51
+ const data = paper.getData();
52
+ const {
53
+ totalWordUsed,
54
+ words,
55
+ isWordUsedExceeding
56
+ } = relatedKeywords;
57
+ let status = 'good';
58
+ if (!data?.related_keywords?.length || totalWordUsed <= 0) {
59
+ status = 'bad';
60
+ }
61
+ if (isWordUsedExceeding) {
62
+ status = 'improve';
63
+ }
64
+ const score = this.getScore(this._config.priority, status);
65
+ return {
66
+ score,
67
+ status,
68
+ body: /*#__PURE__*/_react.default.createElement(_RelatedKeywordsDescription.default, {
69
+ words,
70
+ i18n
71
+ })
72
+ };
73
+ }
74
+
75
+ /**
76
+ *
77
+ * @param paper
78
+ * @param researcher
79
+ * @param i18n
80
+ * @returns {AssessmentResult}
81
+ */
82
+ getResult({
83
+ paper,
84
+ researcher,
85
+ i18n
86
+ }) {
87
+ const relatedKeywords = researcher.getResearch('checkRelatedKeywords');
88
+ const result = this.calculateResult(paper, relatedKeywords, i18n);
89
+ const assessmentResult = new _AssessmentResult.default({
90
+ config: this._config
91
+ });
92
+ assessmentResult.setScore(result.score);
93
+ assessmentResult.setStatus(result.status);
94
+ assessmentResult.setBody(result.body);
95
+ return assessmentResult;
96
+ }
97
+
98
+ /**
99
+ * Checks if the transition words assessment is applicable to the paper. Language-specific length requirements and methods of counting text length
100
+ * may apply (e.g. for Japanese, the text should be counted in characters instead of words, which also makes the minimum required length higher).
101
+ *
102
+ * @param {Paper} paper The paper to check.
103
+ * @param {Researcher} researcher The researcher object.
104
+ *
105
+ * @returns {boolean} Returns true if the language is available, the paper is not empty and the text is longer than the minimum required length.
106
+ */
107
+ isApplicable(paper, researcher) {
108
+ return paper.hasRelatedKeywords();
109
+ }
110
+ }
111
+ exports.default = RelatedKeywordsAssessment;
112
+ //# sourceMappingURL=RelatedKeywordsAssessment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RelatedKeywordsAssessment.js","names":["_lodash","require","_react","_interopRequireDefault","_AssessmentResult","_assessment","_RelatedKeywordsDescription","e","__esModule","default","RelatedKeywordsAssessment","Assessment","constructor","config","defaultConfig","id","fixPosition","ctaType","docUrl","priority","title","content","good","bad","improve","identifier","_config","merge","calculateResult","paper","relatedKeywords","i18n","data","getData","totalWordUsed","words","isWordUsedExceeding","status","related_keywords","length","score","getScore","body","createElement","getResult","researcher","getResearch","result","assessmentResult","AssessmentResult","setScore","setStatus","setBody","isApplicable","hasRelatedKeywords","exports"],"sources":["../../../../src/scoring/assessments/readability/RelatedKeywordsAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport React from 'react';\n\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport Assessment from '../assessment';\n\nimport RelatedKeywordsDescription from '@axyseo/components/RelatedKeywordsDescription';\n\n/**\n * Represents the assessment that checks whether there are enough transition words in the text.\n */\nexport default class RelatedKeywordsAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {object} config The configuration to use.\n *\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: 'relatedKeywords',\n fixPosition: 'description',\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#duplicate-title',\n priority: 'high',\n title: 'Related keywords',\n content: {\n good: 'Related keyword density is optimized',\n bad:\n 'Consider using at least a related keyword in your page to establish topical relevance.',\n improve: 'Too high related keyword density. Keep related keyword density from 0.5% - 1%.'\n }\n };\n\n this.identifier = 'relatedKeywords';\n this._config = merge(defaultConfig, config);\n }\n\n /**\n *\n * @param paper\n * @param relatedKeywords\n * @param i18n\n * @returns {{score: number, body: React.JSX.Element, status: string}}\n */\n calculateResult(paper, relatedKeywords, i18n) {\n const data = paper.getData();\n const {totalWordUsed, words, isWordUsedExceeding} = relatedKeywords;\n let status = 'good';\n if (!data?.related_keywords?.length || totalWordUsed <= 0) {\n status = 'bad';\n }\n\n if (isWordUsedExceeding) {\n status = 'improve';\n }\n\n const score = this.getScore(this._config.priority, status);\n\n return {\n score,\n status,\n body: <RelatedKeywordsDescription {...{words, i18n}} />\n };\n }\n\n /**\n *\n * @param paper\n * @param researcher\n * @param i18n\n * @returns {AssessmentResult}\n */\n getResult({paper, researcher, i18n}) {\n const relatedKeywords = researcher.getResearch('checkRelatedKeywords');\n\n const result = this.calculateResult(paper, relatedKeywords, i18n);\n const assessmentResult = new AssessmentResult({config: this._config});\n\n assessmentResult.setScore(result.score);\n assessmentResult.setStatus(result.status);\n assessmentResult.setBody(result.body);\n\n return assessmentResult;\n }\n\n /**\n * Checks if the transition words assessment is applicable to the paper. Language-specific length requirements and methods of counting text length\n * may apply (e.g. for Japanese, the text should be counted in characters instead of words, which also makes the minimum required length higher).\n *\n * @param {Paper} paper The paper to check.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} Returns true if the language is available, the paper is not empty and the text is longer than the minimum required length.\n */\n isApplicable(paper, researcher) {\n return paper.hasRelatedKeywords();\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,WAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA,IAAAK,2BAAA,GAAAH,sBAAA,CAAAF,OAAA;AAAuF,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEvF;AACA;AACA;AACe,MAAMG,yBAAyB,SAASC,mBAAU,CAAC;EAChE;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAE,iBAAiB;MACrBC,WAAW,EAAE,aAAa;MAC1BC,OAAO,EAAE,KAAK;MACdC,MAAM,EACJ,6FAA6F;MA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AAI,CAAC;IACjE,MAAMiB,gBAAgB,GAAG,IAAIC,yBAAgB,CAAC;MAACpC,MAAM,EAAE,IAAI,CAACa;IAAO,CAAC,CAAC;IAErEsB,gBAAgB,CAACE,QAAQ,CAACH,MAAM,CAACP,KAAK,CAAC;IACvCQ,gBAAgB,CAACG,SAAS,CAACJ,MAAM,CAACV,MAAM,CAAC;IACzCW,gBAAgB,CAACI,OAAO,CAACL,MAAM,CAACL,IAAI,CAAC;IAErC,OAAOM,gBAAgB;EACzB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEK,YAAYA,CAACxB,KAAK,EAAEgB,UAAU,EAAE;IAC9B,OAAOhB,KAAK,CAACyB,kBAAkB,CAAC,CAAC;EACnC;AACF;AAACC,OAAA,CAAA9C,OAAA,GAAAC,yBAAA","ignoreList":[]}
@@ -114,7 +114,7 @@ class SentenceBeginningsAssessment extends _assessment.default {
114
114
  const assessmentResult = new _AssessmentResult.default({
115
115
  config: this._config
116
116
  });
117
- assessmentResult.setStatus(calculatedResult.status);
117
+ assessmentResult.setScore(calculatedResult.score);
118
118
  assessmentResult.setStatus(calculatedResult.status);
119
119
  assessmentResult.setBody(calculatedResult.body);
120
120
  return assessmentResult;
@@ -1 +1 @@
1
- {"version":3,"file":"SentenceBeginningsAssessment.js","names":["_lodash","require","_react","_interopRequireDefault","_polaris","_AssessmentResult","_assessment","_polarisIcons","e","__esModule","default","maximumConsecutiveDuplicates","SentenceBeginningsAssessment","Assessment","constructor","config","defaultConfig","id","priority","ctaType","docUrl","fixPosition","icon","TextBlockIcon","title","content","improve","bad","good","identifier","_config","merge","groupSentenceBeginnings","sentenceBeginnings","tooOften","partition","word","count","length","total","sortedCounts","sortBy","lowestCount","calculateSentenceBeginningsResult","groupedSentenceBeginnings","i18n","status","score","getScore","body","createElement","Text","as","href","target","rel","translate","getResult","paper","researcher","getResearch","calculatedResult","assessmentResult","AssessmentResult","setStatus","setBody","isApplicable","hasEnoughContentForAssessment","hasResearch","exports"],"sources":["../../../../src/scoring/assessments/readability/SentenceBeginningsAssessment.js"],"sourcesContent":["import {merge, partition, sortBy} from 'lodash';\nimport React from 'react';\nimport {Text} from '@shopify/polaris';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport Assessment from '../assessment';\nimport {TextBlockIcon} from '@shopify/polaris-icons';\n\nconst maximumConsecutiveDuplicates = 2;\n\n/**\n * Represents the assessment that checks whether there are three or more consecutive sentences beginning with the same word.\n */\nexport default class SentenceBeginningsAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {object} config The configuration to use.\n *\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: 'sentenceBeginnings',\n priority: 'medium',\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#sentence-beginnings',\n fixPosition: 'description',\n icon: TextBlockIcon,\n title: 'Sentence beginnings',\n content: {\n improve: '',\n bad:\n 'Found sentences with repetitive beginnings. Change the wording for more engaging content.',\n good: 'No sentences with repetitive beginnings found.'\n }\n };\n\n this.identifier = 'sentenceBeginnings';\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Counts and groups the number too often used sentence beginnings and determines the lowest count within that group.\n *\n * @param {array} sentenceBeginnings The array containing the objects containing the beginning words and counts.\n *\n * @returns {object} The object containing the total number of too often used beginnings and the lowest count within those.\n */\n groupSentenceBeginnings(sentenceBeginnings) {\n const tooOften = partition(sentenceBeginnings, function(word) {\n return word.count > maximumConsecutiveDuplicates;\n });\n\n if (tooOften[0].length === 0) {\n return {total: 0};\n }\n\n const sortedCounts = sortBy(tooOften[0], function(word) {\n return word.count;\n });\n\n return {total: tooOften[0].length, lowestCount: sortedCounts[0].count};\n }\n\n /**\n *\n * @param groupedSentenceBeginnings\n * @param i18n\n * @returns {{score: number, body: React.JSX.Element, status: string}}\n */\n calculateSentenceBeginningsResult(groupedSentenceBeginnings, i18n) {\n let status = '';\n if (groupedSentenceBeginnings.total > 0) {\n status = 'bad';\n } else {\n status = 'good';\n }\n\n const score = this.getScore(this._config.priority, status);\n\n return {\n score,\n status,\n body: (\n <Text as={'span'}>\n {this._config.content[status]}{' '}\n {this._config.docUrl && (\n <a href={this._config.docUrl} target=\"_blank\" rel=\"noreferrer\">\n {i18n ? i18n.translate(`Axyseo.Button.learnMore`) : 'Learn more'}\n </a>\n )}\n </Text>\n )\n };\n }\n\n /**\n *\n * @param paper\n * @param researcher\n * @param i18n\n * @returns {AssessmentResult}\n */\n getResult({paper, researcher, i18n}) {\n const sentenceBeginnings = researcher.getResearch('getSentenceBeginnings');\n const groupedSentenceBeginnings = this.groupSentenceBeginnings(sentenceBeginnings);\n const calculatedResult = this.calculateSentenceBeginningsResult(\n groupedSentenceBeginnings,\n i18n\n );\n const assessmentResult = new AssessmentResult({config: this._config});\n\n assessmentResult.setStatus(calculatedResult.status);\n assessmentResult.setStatus(calculatedResult.status);\n assessmentResult.setBody(calculatedResult.body);\n\n return assessmentResult;\n }\n\n /**\n * Checks if the sentence beginnings assessment is applicable to the paper.\n *\n * @param {Object} paper The paper to check.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} Returns true if the language is available and the paper is not empty.\n */\n isApplicable(paper, researcher) {\n return (\n this.hasEnoughContentForAssessment(paper) && researcher.hasResearch('getSentenceBeginnings')\n );\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAAqD,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErD,MAAMG,4BAA4B,GAAG,CAAC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ACe;IAAO,CAAC,CAAC;IAErEgC,gBAAgB,CAACE,SAAS,CAACH,gBAAgB,CAACf,MAAM,CAAC;IACnDgB,gBAAgB,CAACE,SAAS,CAACH,gBAAgB,CAACf,MAAM,CAAC;IACnDgB,gBAAgB,CAACG,OAAO,CAACJ,gBAAgB,CAACZ,IAAI,CAAC;IAE/C,OAAOa,gBAAgB;EACzB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEI,YAAYA,CAACR,KAAK,EAAEC,UAAU,EAAE;IAC9B,OACE,IAAI,CAACQ,6BAA6B,CAACT,KAAK,CAAC,IAAIC,UAAU,CAACS,WAAW,CAAC,uBAAuB,CAAC;EAEhG;AACF;AAACC,OAAA,CAAA3D,OAAA,GAAAE,4BAAA","ignoreList":[]}
1
+ {"version":3,"file":"SentenceBeginningsAssessment.js","names":["_lodash","require","_react","_interopRequireDefault","_polaris","_AssessmentResult","_assessment","_polarisIcons","e","__esModule","default","maximumConsecutiveDuplicates","SentenceBeginningsAssessment","Assessment","constructor","config","defaultConfig","id","priority","ctaType","docUrl","fixPosition","icon","TextBlockIcon","title","content","improve","bad","good","identifier","_config","merge","groupSentenceBeginnings","sentenceBeginnings","tooOften","partition","word","count","length","total","sortedCounts","sortBy","lowestCount","calculateSentenceBeginningsResult","groupedSentenceBeginnings","i18n","status","score","getScore","body","createElement","Text","as","href","target","rel","translate","getResult","paper","researcher","getResearch","calculatedResult","assessmentResult","AssessmentResult","setScore","setStatus","setBody","isApplicable","hasEnoughContentForAssessment","hasResearch","exports"],"sources":["../../../../src/scoring/assessments/readability/SentenceBeginningsAssessment.js"],"sourcesContent":["import {merge, partition, sortBy} from 'lodash';\nimport React from 'react';\nimport {Text} from '@shopify/polaris';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport Assessment from '../assessment';\nimport {TextBlockIcon} from '@shopify/polaris-icons';\n\nconst maximumConsecutiveDuplicates = 2;\n\n/**\n * Represents the assessment that checks whether there are three or more consecutive sentences beginning with the same word.\n */\nexport default class SentenceBeginningsAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {object} config The configuration to use.\n *\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: 'sentenceBeginnings',\n priority: 'medium',\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#sentence-beginnings',\n fixPosition: 'description',\n icon: TextBlockIcon,\n title: 'Sentence beginnings',\n content: {\n improve: '',\n bad:\n 'Found sentences with repetitive beginnings. Change the wording for more engaging content.',\n good: 'No sentences with repetitive beginnings found.'\n }\n };\n\n this.identifier = 'sentenceBeginnings';\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Counts and groups the number too often used sentence beginnings and determines the lowest count within that group.\n *\n * @param {array} sentenceBeginnings The array containing the objects containing the beginning words and counts.\n *\n * @returns {object} The object containing the total number of too often used beginnings and the lowest count within those.\n */\n groupSentenceBeginnings(sentenceBeginnings) {\n const tooOften = partition(sentenceBeginnings, function(word) {\n return word.count > maximumConsecutiveDuplicates;\n });\n\n if (tooOften[0].length === 0) {\n return {total: 0};\n }\n\n const sortedCounts = sortBy(tooOften[0], function(word) {\n return word.count;\n });\n\n return {total: tooOften[0].length, lowestCount: sortedCounts[0].count};\n }\n\n /**\n *\n * @param groupedSentenceBeginnings\n * @param i18n\n * @returns {{score: number, body: React.JSX.Element, status: string}}\n */\n calculateSentenceBeginningsResult(groupedSentenceBeginnings, i18n) {\n let status = '';\n if (groupedSentenceBeginnings.total > 0) {\n status = 'bad';\n } else {\n status = 'good';\n }\n\n const score = this.getScore(this._config.priority, status);\n\n return {\n score,\n status,\n body: (\n <Text as={'span'}>\n {this._config.content[status]}{' '}\n {this._config.docUrl && (\n <a href={this._config.docUrl} target=\"_blank\" rel=\"noreferrer\">\n {i18n ? i18n.translate(`Axyseo.Button.learnMore`) : 'Learn more'}\n </a>\n )}\n </Text>\n )\n };\n }\n\n /**\n *\n * @param paper\n * @param researcher\n * @param i18n\n * @returns {AssessmentResult}\n */\n getResult({paper, researcher, i18n}) {\n const sentenceBeginnings = researcher.getResearch('getSentenceBeginnings');\n const groupedSentenceBeginnings = this.groupSentenceBeginnings(sentenceBeginnings);\n const calculatedResult = this.calculateSentenceBeginningsResult(\n groupedSentenceBeginnings,\n i18n\n );\n const assessmentResult = new AssessmentResult({config: this._config});\n\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n assessmentResult.setBody(calculatedResult.body);\n\n return assessmentResult;\n }\n\n /**\n * Checks if the sentence beginnings assessment is applicable to the paper.\n *\n * @param {Object} paper The paper to check.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} Returns true if the language is available and the paper is not empty.\n */\n isApplicable(paper, researcher) {\n return (\n this.hasEnoughContentForAssessment(paper) && researcher.hasResearch('getSentenceBeginnings')\n );\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAAqD,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErD,MAAMG,4BAA4B,GAAG,CAAC;;AAEtC;AACA;AACA;AACe,MAAMC,4BAA4B,SAASC,mBAAU,CAAC;EACnE;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAE,oBAAoB;MACxBC,QAAQ,EAAE,QAAQ;MAClBC,OAAO,EAAE,KAAK;MACdC,MAAM,EACJ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A,CAACT,KAAK,EAAEC,UAAU,EAAE;IAC9B,OACE,IAAI,CAACS,6BAA6B,CAACV,KAAK,CAAC,IAAIC,UAAU,CAACU,WAAW,CAAC,uBAAuB,CAAC;EAEhG;AACF;AAACC,OAAA,CAAA5D,OAAA,GAAAE,4BAAA","ignoreList":[]}
@@ -11,6 +11,7 @@ var _SentenceLengthInTextAssessment = _interopRequireDefault(require("../assessm
11
11
  var _SentenceBeginningsAssessment = _interopRequireDefault(require("../assessments/readability/SentenceBeginningsAssessment.js"));
12
12
  var _TransitionWordsAssessment = _interopRequireDefault(require("../assessments/readability/TransitionWordsAssessment.js"));
13
13
  var _scoreToRating = _interopRequireDefault(require("../interpreters/scoreToRating.js"));
14
+ var _RelatedKeywordsAssessment = _interopRequireDefault(require("../assessments/readability/RelatedKeywordsAssessment"));
14
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
16
  /**
16
17
  * The ContentAssessor class is used for the readability analysis.
@@ -24,7 +25,7 @@ class ContentAssessor extends _assessor.default {
24
25
  constructor(researcher, config) {
25
26
  super(researcher, config);
26
27
  this.type = 'contentAssessor';
27
- this._assessments = [new _ParagraphTooLongAssessment.default(), new _SentenceLengthInTextAssessment.default(), new _TransitionWordsAssessment.default(), new _SentenceBeginningsAssessment.default()];
28
+ this._assessments = [new _ParagraphTooLongAssessment.default(), new _SentenceLengthInTextAssessment.default(), new _TransitionWordsAssessment.default(), new _SentenceBeginningsAssessment.default(), new _RelatedKeywordsAssessment.default()];
28
29
  }
29
30
 
30
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"contentAssessor.js","names":["_lodash","require","_assessor","_interopRequireDefault","_ParagraphTooLongAssessment","_SentenceLengthInTextAssessment","_SentenceBeginningsAssessment","_TransitionWordsAssessment","_scoreToRating","e","__esModule","default","ContentAssessor","Assessor","constructor","researcher","config","type","_assessments","ParagraphTooLong","SentenceLengthInText","TransitionWords","SentenceBeginnings","calculatePenaltyPointsFullSupport","rating","calculatePenaltyPointsPartialSupport","_allAssessmentsSupported","numberOfAssessments","length","applicableAssessments","getApplicableAssessments","calculatePenaltyPoints","results","getValidResults","penaltyPoints","map","result","scoreToRating","getScore","bind","sum","_ratePenaltyPoints","totalPenaltyPoints","calculateOverallScore","exports"],"sources":["../../../src/scoring/assessors/contentAssessor.js"],"sourcesContent":["import {map, sum} from 'lodash';\nimport Assessor from './assessor.js';\nimport ParagraphTooLong from '../assessments/readability/ParagraphTooLongAssessment.js';\nimport SentenceLengthInText from '../assessments/readability/SentenceLengthInTextAssessment.js';\nimport SentenceBeginnings from '../assessments/readability/SentenceBeginningsAssessment.js';\nimport TransitionWords from '../assessments/readability/TransitionWordsAssessment.js';\nimport scoreToRating from '../interpreters/scoreToRating.js';\n\n/**\n * The ContentAssessor class is used for the readability analysis.\n */\nexport default class ContentAssessor extends Assessor {\n /**\n * Creates a new ContentAssessor instance.\n * @param {Researcher}\tresearcher\tThe researcher to use.\n * @param {Object}\t\t[config]\tThe assessor config.\n */\n constructor(researcher, config) {\n super(researcher, config);\n this.type = 'contentAssessor';\n\n this._assessments = [\n new ParagraphTooLong(),\n new SentenceLengthInText(),\n new TransitionWords(),\n new SentenceBeginnings()\n ];\n }\n\n /**\n * Calculates the weighted rating for languages that have all assessments based on a given rating.\n *\n * @param {string} rating The rating to be weighted.\n * @returns {number} The weighted rating.\n */\n calculatePenaltyPointsFullSupport(rating) {\n switch (rating) {\n case 'bad':\n return 3;\n case 'ok':\n return 2;\n default:\n case 'good':\n return 0;\n }\n }\n\n /**\n * Calculates the weighted rating for languages that don't have all assessments based on a given rating.\n *\n * @param {string} rating The rating to be weighted.\n * @returns {number} The weighted rating.\n */\n calculatePenaltyPointsPartialSupport(rating) {\n switch (rating) {\n case 'bad':\n return 4;\n case 'ok':\n return 2;\n default:\n case 'good':\n return 0;\n }\n }\n\n /**\n * Determines whether a language is fully supported. If a language supports 7 content assessments,\n * it is fully supported\n *\n * @returns {boolean} True if fully supported.\n */\n _allAssessmentsSupported() {\n const numberOfAssessments = this._assessments.length;\n const applicableAssessments = this.getApplicableAssessments();\n return applicableAssessments.length === numberOfAssessments;\n }\n\n /**\n * Calculates the penalty points based on the assessment results.\n *\n * @returns {number} The total penalty points for the results.\n */\n calculatePenaltyPoints() {\n const results = this.getValidResults();\n\n const penaltyPoints = map(\n results,\n function(result) {\n const rating = scoreToRating(result.getScore());\n\n if (this._allAssessmentsSupported()) {\n return this.calculatePenaltyPointsFullSupport(rating);\n }\n\n return this.calculatePenaltyPointsPartialSupport(rating);\n }.bind(this)\n );\n\n return sum(penaltyPoints);\n }\n\n /**\n * Rates the penalty points\n *\n * @param {number} totalPenaltyPoints The amount of penalty points.\n * @returns {number} The score based on the amount of penalty points.\n *\n * @private\n */\n _ratePenaltyPoints(totalPenaltyPoints) {\n if (this.getValidResults().length === 1) {\n // If we have only 1 result, we only have a \"no content\" result\n return 30;\n }\n\n if (this._allAssessmentsSupported()) {\n // Determine the total score based on the total penalty points.\n if (totalPenaltyPoints > 6) {\n // A red indicator.\n return 30;\n }\n\n if (totalPenaltyPoints > 4) {\n // An orange indicator.\n return 60;\n }\n } else {\n if (totalPenaltyPoints > 4) {\n // A red indicator.\n return 30;\n }\n\n if (totalPenaltyPoints > 2) {\n // An orange indicator.\n return 60;\n }\n }\n // A green indicator.\n return 90;\n }\n\n /**\n * Calculates the overall score based on the assessment results.\n *\n * @returns {number} The overall score.\n */\n calculateOverallScore() {\n const results = this.getValidResults();\n\n // If you have no content, you have a red indicator.\n if (results.length === 0) {\n return 30;\n }\n\n const totalPenaltyPoints = this.calculatePenaltyPoints();\n\n return this._ratePenaltyPoints(totalPenaltyPoints);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,+BAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,6BAAA,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OAAO,CAACJ,MAAM,KAAK,CAAC,EAAE;MACxB,OAAO,EAAE;IACX;IAEA,MAAMc,kBAAkB,GAAG,IAAI,CAACX,sBAAsB,CAAC,CAAC;IAExD,OAAO,IAAI,CAACU,kBAAkB,CAACC,kBAAkB,CAAC;EACpD;AACF;AAACE,OAAA,CAAAjC,OAAA,GAAAC,eAAA","ignoreList":[]}
1
+ {"version":3,"file":"contentAssessor.js","names":["_lodash","require","_assessor","_interopRequireDefault","_ParagraphTooLongAssessment","_SentenceLengthInTextAssessment","_SentenceBeginningsAssessment","_TransitionWordsAssessment","_scoreToRating","_RelatedKeywordsAssessment","e","__esModule","default","ContentAssessor","Assessor","constructor","researcher","config","type","_assessments","ParagraphTooLong","SentenceLengthInText","TransitionWords","SentenceBeginnings","RelatedKeywordsAssessment","calculatePenaltyPointsFullSupport","rating","calculatePenaltyPointsPartialSupport","_allAssessmentsSupported","numberOfAssessments","length","applicableAssessments","getApplicableAssessments","calculatePenaltyPoints","results","getValidResults","penaltyPoints","map","result","scoreToRating","getScore","bind","sum","_ratePenaltyPoints","totalPenaltyPoints","calculateOverallScore","exports"],"sources":["../../../src/scoring/assessors/contentAssessor.js"],"sourcesContent":["import {map, sum} from 'lodash';\nimport Assessor from './assessor.js';\nimport ParagraphTooLong from '../assessments/readability/ParagraphTooLongAssessment.js';\nimport SentenceLengthInText from '../assessments/readability/SentenceLengthInTextAssessment.js';\nimport SentenceBeginnings from '../assessments/readability/SentenceBeginningsAssessment.js';\nimport TransitionWords from '../assessments/readability/TransitionWordsAssessment.js';\nimport scoreToRating from '../interpreters/scoreToRating.js';\nimport RelatedKeywordsAssessment from '@axyseo/scoring/assessments/readability/RelatedKeywordsAssessment';\n\n/**\n * The ContentAssessor class is used for the readability analysis.\n */\nexport default class ContentAssessor extends Assessor {\n /**\n * Creates a new ContentAssessor instance.\n * @param {Researcher}\tresearcher\tThe researcher to use.\n * @param {Object}\t\t[config]\tThe assessor config.\n */\n constructor(researcher, config) {\n super(researcher, config);\n this.type = 'contentAssessor';\n\n this._assessments = [\n new ParagraphTooLong(),\n new SentenceLengthInText(),\n new TransitionWords(),\n new SentenceBeginnings(),\n new RelatedKeywordsAssessment()\n ];\n }\n\n /**\n * Calculates the weighted rating for languages that have all assessments based on a given rating.\n *\n * @param {string} rating The rating to be weighted.\n * @returns {number} The weighted rating.\n */\n calculatePenaltyPointsFullSupport(rating) {\n switch (rating) {\n case 'bad':\n return 3;\n case 'ok':\n return 2;\n default:\n case 'good':\n return 0;\n }\n }\n\n /**\n * Calculates the weighted rating for languages that don't have all assessments based on a given rating.\n *\n * @param {string} rating The rating to be weighted.\n * @returns {number} The weighted rating.\n */\n calculatePenaltyPointsPartialSupport(rating) {\n switch (rating) {\n case 'bad':\n return 4;\n case 'ok':\n return 2;\n default:\n case 'good':\n return 0;\n }\n }\n\n /**\n * Determines whether a language is fully supported. If a language supports 7 content assessments,\n * it is fully supported\n *\n * @returns {boolean} True if fully supported.\n */\n _allAssessmentsSupported() {\n const numberOfAssessments = this._assessments.length;\n const applicableAssessments = this.getApplicableAssessments();\n return applicableAssessments.length === numberOfAssessments;\n }\n\n /**\n * Calculates the penalty points based on the assessment results.\n *\n * @returns {number} The total penalty points for the results.\n */\n calculatePenaltyPoints() {\n const results = this.getValidResults();\n\n const penaltyPoints = map(\n results,\n function(result) {\n const rating = scoreToRating(result.getScore());\n\n if (this._allAssessmentsSupported()) {\n return this.calculatePenaltyPointsFullSupport(rating);\n }\n\n return this.calculatePenaltyPointsPartialSupport(rating);\n }.bind(this)\n );\n\n return sum(penaltyPoints);\n }\n\n /**\n * Rates the penalty points\n *\n * @param {number} totalPenaltyPoints The amount of penalty points.\n * @returns {number} The score based on the amount of penalty points.\n *\n * @private\n */\n _ratePenaltyPoints(totalPenaltyPoints) {\n if (this.getValidResults().length === 1) {\n // If we have only 1 result, we only have a \"no content\" result\n return 30;\n }\n\n if (this._allAssessmentsSupported()) {\n // Determine the total score based on the total penalty points.\n if (totalPenaltyPoints > 6) {\n // A red indicator.\n return 30;\n }\n\n if (totalPenaltyPoints > 4) {\n // An orange indicator.\n return 60;\n }\n } else {\n if (totalPenaltyPoints > 4) {\n // A red indicator.\n return 30;\n }\n\n if (totalPenaltyPoints > 2) {\n // An orange indicator.\n return 60;\n }\n }\n // A green indicator.\n return 90;\n }\n\n /**\n * Calculates the overall score based on the assessment results.\n *\n * @returns {number} The overall score.\n */\n calculateOverallScore() {\n const results = this.getValidResults();\n\n // If you have no content, you have a red indicator.\n if (results.length === 0) {\n return 30;\n }\n\n const totalPenaltyPoints = this.calculatePenaltyPoints();\n\n return this._ratePenaltyPoints(totalPenaltyPoints);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,+BAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,6BAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,0BAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,cAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,0BAAA,GAAAN,sBAAA,CAAAF,OAAA;AAA0G,SAAAE,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE1G;AACA;AACA;AACe,MAAMG,eAAe,SAASC,iBAAQ,CAAC;EACpD;AACF;AACA;AACA;AACA;EACEC,WAAWA,CAACC,UAAU,EAAEC,MAAM,EAAE;IAC9B,KAAK,CAACD,UAAU,EAAEC,MAAM,CAAC;IACzB,IAAI,CAACC,IAAI,GAAG,iBAAiB;IAE7B,IAAI,CAACC,YAAY,GAAG,CAClB,IAAIC,mCAAgB,CAAC,CAAC,EACtB,IAAIC,uCAAoB,CAAC,CAAC,EAC1B,IAAIC,kCAAe,CAAC,CAAC,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AAC;EAC3B;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEO,kBAAkBA,CAACC,kBAAkB,EAAE;IACrC,IAAI,IAAI,CAACT,eAAe,CAAC,CAAC,CAACL,MAAM,KAAK,CAAC,EAAE;MACvC;MACA,OAAO,EAAE;IACX;IAEA,IAAI,IAAI,CAACF,wBAAwB,CAAC,CAAC,EAAE;MACnC;MACA,IAAIgB,kBAAkB,GAAG,CAAC,EAAE;QAC1B;QACA,OAAO,EAAE;MACX;MAEA,IAAIA,kBAAkB,GAAG,CAAC,EAAE;QAC1B;QACA,OAAO,EAAE;MACX;IACF,CAAC,MAAM;MACL,IAAIA,kBAAkB,GAAG,CAAC,EAAE;QAC1B;QACA,OAAO,EAAE;MACX;MAEA,IAAIA,kBAAkB,GAAG,CAAC,EAAE;QAC1B;QACA,OAAO,EAAE;MACX;IACF;IACA;IACA,OAAO,EAAE;EACX;;EAEA;AACF;AACA;AACA;AACA;EACEC,qBAAqBA,CAAA,EAAG;IACtB,MAAMX,OAAO,GAAG,IAAI,CAACC,eAAe,CAAC,CAAC;;IAEtC;IACA,IAAID,OAAO,CAACJ,MAAM,KAAK,CAAC,EAAE;MACxB,OAAO,EAAE;IACX;IAEA,MAAMc,kBAAkB,GAAG,IAAI,CAACX,sBAAsB,CAAC,CAAC;IAExD,OAAO,IAAI,CAACU,kBAAkB,CAACC,kBAAkB,CAAC;EACpD;AACF;AAACE,OAAA,CAAAlC,OAAA,GAAAC,eAAA","ignoreList":[]}
@@ -55,6 +55,7 @@ class Paper {
55
55
  * @param {Object[]} [attributes.wpBlocks] The array of texts, encoded in WordPress block editor blocks.
56
56
  * @param {Object[]} [attributes.ignoredAssessments] The array of texts, show which assessments should be ignored.
57
57
  * @param {Object[]} [attributes.skippedAssessments] The array of texts, show which assessments should be skipped (those assessments will have good result).
58
+ * @param {Object} [attributes.data] Given data.
58
59
  * @param {Object} [attributes.customData] Custom data.
59
60
  * @param {Object} [attributes.shopSettings] Shop's settings.
60
61
  * @param {string} [attributes.textTitle] The title of the text.
@@ -275,6 +276,32 @@ class Paper {
275
276
  return this._attributes?.hasProductSchema || false;
276
277
  }
277
278
 
279
+ /**
280
+ *
281
+ * @returns {(function(): *)|boolean}
282
+ */
283
+ hasData() {
284
+ const data = this._attributes?.data;
285
+ return (0, _lodash.isObject)(data) && !(0, _lodash.isEmpty)(data);
286
+ }
287
+
288
+ /**
289
+ *
290
+ * @returns {(function(): *)|boolean}
291
+ */
292
+ hasRelatedKeywords() {
293
+ const relatedKeywords = this._attributes?.data?.related_keywords || [];
294
+ return Array.isArray(relatedKeywords) && relatedKeywords.length > 0;
295
+ }
296
+
297
+ /**
298
+ *
299
+ * @returns {Object|{}}
300
+ */
301
+ getData() {
302
+ return this._attributes?.data || {};
303
+ }
304
+
278
305
  /**
279
306
  *
280
307
  * @returns {Object[String]|*[String]}
@@ -1 +1 @@
1
- {"version":3,"file":"Paper.js","names":["_lodash","require","defaultAttributes","keyword","synonyms","description","title","titleWidth","titleCount","h1Count","slug","domain","locale","permalink","date","customData","textTitle","writingDirection","wpBlocks","isFrontPage","Paper","constructor","text","attributes","_text","_tree","defaults","hasOwnProperty","url","onlyLetters","replace","isEmpty","_attributes","hasKeyword","getKeyword","getAttributes","hasSynonyms","getSynonyms","hasH1Count","isNull","getH1Count","hasTitleCount","getTitleCount","hasText","getText","getDomain","setTree","tree","getTree","hasDescription","getDescription","hasTitle","getTitle","hasTitleWidth","getTitleWidth","hasSlug","hasShopSettings","shopSettings","getSlug","hasProductSchema","getIgnoredAssessments","ignoredAssessments","getSkippedAssessments","skippedAssessments","getShopSettings","hasUrl","console","warn","getUrl","hasLocale","getLocale","getWritingDirection","hasPermalink","getPermalink","hasDate","getDate","hasCustomData","getCustomData","hasTextTitle","isNil","getTextTitle","serialize","_parseClass","equals","paper","isEqual","parse","serialized","exports","default"],"sources":["../../src/values/Paper.js"],"sourcesContent":["import {defaults, isEmpty, isEqual, isNil, isNull} from 'lodash';\n\n/**\n * Default attributes to be used by the Paper if they are left undefined.\n * @type {{keyword: string, synonyms: string, description: string, title: string, titleWidth: number,\n * \t\t slug: string, locale: string, permalink: string, date: string, customData: object, textTitle: string,\n * \t\t writingDirection: \"LTR\", isFrontPage: boolean }}\n */\nconst defaultAttributes = {\n keyword: '',\n synonyms: '',\n description: '',\n title: '',\n titleWidth: 0,\n titleCount: null,\n h1Count: null,\n slug: '',\n domain: '',\n locale: 'en_US',\n permalink: '',\n date: '',\n customData: {},\n textTitle: '',\n writingDirection: 'LTR',\n wpBlocks: [],\n isFrontPage: false\n};\n\n/**\n * Represents an object where the analysis data is stored.\n */\nexport default class Paper {\n /**\n * Constructs the Paper object and sets its attributes.\n *\n * @param {string} text The text to use in the analysis.\n * @param {object} [attributes] The object containing all attributes.\n * @param {string} [attributes.keyword] The main keyword or keyphrase of the text.\n * @param {string} [attributes.synonyms] The synonyms of the main keyword or keyphrase. It should be separated by commas if multiple synonyms are added.\n * @param {string} [attributes.description] The SEO meta description.\n * @param {string} [attributes.title] The SEO title.\n * @param {string} [attributes.domain] The shop domain.\n * @param {number|null} [attributes.titleCount=null] The title tag count value.\n * @param {number|null} [attributes.h1Count=null] The h1 tag count value.\n * @param {number} [attributes.titleWidth=0] The width of the title in pixels.\n * @param {string} [attributes.slug] The slug.\n * @param {string} [attributes.locale=en_US] The locale.\n * @param {string} [attributes.permalink] The full URL for any given post, page, or other pieces of content on a site.\n * @param {string} [attributes.date] The date.\n * @param {Object[]} [attributes.wpBlocks] The array of texts, encoded in WordPress block editor blocks.\n * @param {Object[]} [attributes.ignoredAssessments] The array of texts, show which assessments should be ignored.\n * @param {Object[]} [attributes.skippedAssessments] The array of texts, show which assessments should be skipped (those assessments will have good result).\n * @param {Object} [attributes.customData] Custom data.\n * @param {Object} [attributes.shopSettings] Shop's settings.\n * @param {string} [attributes.textTitle] The title of the text.\n * @param {string} [attributes.writingDirection=LTR] The writing direction of the paper. Defaults to left to right (LTR).\n * @param {boolean} [attributes.isFrontPage=false] Whether the current page is the front page of the site. Defaults to false.\n */\n constructor(text, attributes) {\n this._text = text || '';\n\n this._tree = null;\n\n attributes = attributes || {};\n defaults(attributes, defaultAttributes);\n\n if (attributes.locale === '') {\n attributes.locale = defaultAttributes.locale;\n }\n\n if (attributes.hasOwnProperty('url')) {\n attributes.slug = attributes.url || attributes.slug;\n }\n\n const onlyLetters = attributes.keyword.replace(\n /[‘’“”\"'.?!:;,¿¡«»&*@#±^%|~`[\\](){}⟨⟩<>/\\\\–\\-\\u2014\\u00d7\\u002b\\s]/g,\n ''\n );\n\n if (isEmpty(onlyLetters)) {\n attributes.keyword = defaultAttributes.keyword;\n }\n\n this._attributes = attributes;\n }\n\n /**\n * Checks whether a keyword is available.\n * @returns {boolean} Returns true if the Paper has a keyword.\n */\n hasKeyword() {\n return this._attributes.keyword !== '';\n }\n\n /**\n * Returns the associated keyword or an empty string if no keyword is available.\n * @returns {string} Returns Keyword\n */\n getKeyword() {\n return this._attributes.keyword;\n }\n\n /**\n *\n * @returns {*|{keyword?: string, synonyms?: string, description?: string, title?: string, titleCount?: (number|null), h1Count?: (number|null), titleWidth?: number, slug?: string, locale?: string, permalink?: string, date?: string, wpBlocks?: Object[], customData?: Object, textTitle?: string, writingDirection?: string, isFrontPage?: boolean}|{}|{}}\n */\n getAttributes() {\n return this._attributes;\n }\n\n /**\n * Checks whether synonyms are available.\n * @returns {boolean} Returns true if the Paper has synonyms.\n */\n hasSynonyms() {\n return this._attributes.synonyms !== '';\n }\n\n /**\n * Returns the associated synonyms or an empty string if no synonyms is available.\n * @returns {string} Returns synonyms.\n */\n getSynonyms() {\n return this._attributes.synonyms;\n }\n\n /**\n * Checks whether the h1 count value is available.\n * @returns {boolean} Returns true if the paper has a h1 count value.\n */\n hasH1Count() {\n return !isNull(this._attributes.h1Count);\n }\n\n /**\n * Returns the h1 tag count value.\n * @returns {number | null}\n */\n getH1Count() {\n return this._attributes.h1Count;\n }\n\n /**\n * Checks whether the title count value is available.\n * @returns {boolean} Returns true if the paper has a title count.\n */\n hasTitleCount() {\n return !isNull(this._attributes.titleCount);\n }\n\n /**\n * Returns the title count value.\n * @returns {number | null}\n */\n getTitleCount() {\n return this._attributes.titleCount;\n }\n\n /**\n * Checks whether the text is available.\n * @returns {boolean} Returns true if the paper has a text.\n */\n hasText() {\n return this._text !== '';\n }\n\n /**\n * Returns the associated text or an empty string if no text is available.\n * @returns {string} Returns the text.\n */\n getText() {\n return this._text;\n }\n\n /**\n * Returns the associated text or an empty string if no text is available.\n * @returns {string} Returns the text.\n */\n getDomain() {\n return this._attributes.domain;\n }\n\n /**\n * Sets the tree.\n *\n * @param {Node} tree The tree to set.\n *\n * @returns {void}\n */\n setTree(tree) {\n this._tree = tree;\n }\n\n /**\n * Returns the tree.\n *\n * @returns {Node} The tree.\n */\n getTree() {\n return this._tree;\n }\n\n /**\n * Checks whether a description is available.\n * @returns {boolean} Returns true if the paper has a description.\n */\n hasDescription() {\n return this._attributes.description !== '';\n }\n\n /**\n * Returns the description or an empty string if no description is available.\n * @returns {string} Returns the description.\n */\n getDescription() {\n return this._attributes.description;\n }\n\n /**\n * Checks whether an SEO title is available\n * @returns {boolean} Returns true if the Paper has an SEO title.\n */\n hasTitle() {\n return this._attributes.title !== '';\n }\n\n /**\n * Returns the SEO title, or an empty string if no title is available.\n * @returns {string} Returns the SEO title.\n */\n getTitle() {\n return this._attributes.title;\n }\n\n /**\n * Checks whether an SEO title width in pixels is available.\n * @returns {boolean} Returns true if the Paper's SEO title is wider than 0 pixels.\n */\n hasTitleWidth() {\n return this._attributes.titleWidth !== 0;\n }\n\n /**\n * Gets the SEO title width in pixels, or an empty string of no title width in pixels is available.\n * @returns {number} Returns the SEO title width in pixels.\n */\n getTitleWidth() {\n return this._attributes.titleWidth;\n }\n\n /**\n * Checks whether a slug is available.\n * @returns {boolean} Returns true if the Paper has a slug.\n */\n hasSlug() {\n return this._attributes.slug !== '';\n }\n\n /**\n * Checks whether a shop settings is available.\n * @returns {boolean} Returns true if the Paper has a shop settings.\n */\n hasShopSettings() {\n return !isEmpty(this._attributes?.shopSettings || {});\n }\n\n /**\n * Gets the paper's slug, or an empty string if no slug is available.\n * @returns {string} Returns the slug.\n */\n getSlug() {\n return this._attributes.slug;\n }\n\n /**\n *\n * @returns {(function(): *)|boolean}\n */\n hasProductSchema() {\n return this._attributes?.hasProductSchema || false;\n }\n\n /**\n *\n * @returns {Object[String]|*[String]}\n */\n getIgnoredAssessments() {\n return this._attributes?.ignoredAssessments || [];\n }\n\n /**\n *\n * @returns {Object[String]|*[String]}\n */\n getSkippedAssessments() {\n return this._attributes?.skippedAssessments || [];\n }\n\n /**\n *\n * @returns {*|{}}\n */\n getShopSettings() {\n return this._attributes?.shopSettings || {};\n }\n\n /**\n * Checks if currently edited page is a front page.\n * @returns {boolean} Returns true if the current page is a front page.\n */\n isFrontPage() {\n return this._attributes.isFrontPage;\n }\n\n /**\n * Checks whether an url is available\n * @deprecated Since version 1.19.1. Use hasSlug instead.\n * @returns {boolean} Returns true if the Paper has a slug.\n */\n hasUrl() {\n console.warn('This function is deprecated, use hasSlug instead');\n return this.hasSlug();\n }\n\n /**\n * Returns the url, or an empty string if no url is available.\n * @deprecated Since version 1.19.1. Use getSlug instead.\n * @returns {string} Returns the url\n */\n getUrl() {\n console.warn('This function is deprecated, use getSlug instead');\n return this.getSlug();\n }\n\n /**\n * Checks whether a locale is available.\n * @returns {boolean} Returns true if the paper has a locale.\n */\n hasLocale() {\n return this._attributes.locale !== '';\n }\n\n /**\n * Returns the locale or an empty string if no locale is available\n * @returns {string} Returns the locale.\n */\n getLocale() {\n return this._attributes.locale;\n }\n\n /**\n * Gets the information of the writing direction of the paper.\n * It returns \"LTR\" (left to right) if this attribute is not provided.\n *\n * @returns {string} Returns the information of the writing direction of the paper.\n */\n getWritingDirection() {\n return this._attributes.writingDirection;\n }\n\n /**\n * Checks whether a permalink is available.\n * @returns {boolean} Returns true if the Paper has a permalink.\n */\n hasPermalink() {\n return this._attributes.permalink !== '';\n }\n\n /**\n * Returns the permalink, or an empty string if no permalink is available.\n * @returns {string} Returns the permalink.\n */\n getPermalink() {\n return this._attributes.permalink;\n }\n\n /**\n * Checks whether a date is available.\n * @returns {boolean} Returns true if the Paper has a date.\n */\n hasDate() {\n return this._attributes.date !== '';\n }\n\n /**\n * Returns the date, or an empty string if no date is available.\n * @returns {string} Returns the date.\n */\n getDate() {\n return this._attributes.date;\n }\n\n /**\n * Checks whether custom data is available.\n * @returns {boolean} Returns true if the Paper has custom data.\n */\n hasCustomData() {\n return !isEmpty(this._attributes.customData);\n }\n\n /**\n * Returns the custom data, or an empty object if no data is available.\n * @returns {Object} Returns the custom data.\n */\n getCustomData() {\n return this._attributes.customData;\n }\n\n /**\n * Checks whether a text title is available.\n * @returns {boolean} Returns true if the Paper has a text title.\n */\n hasTextTitle() {\n return this._attributes.textTitle !== '' && !isNil(this._attributes.textTitle);\n }\n\n /**\n * Returns the text title, or an empty string if no data is available.\n * @returns {string} Returns the text title.\n */\n getTextTitle() {\n return this._attributes.textTitle;\n }\n\n /**\n * Serializes the Paper instance to an object.\n *\n * @returns {Object} The serialized Paper.\n */\n serialize() {\n return {\n _parseClass: 'Paper',\n text: this._text,\n ...this._attributes\n };\n }\n\n /**\n * Checks whether the given paper has the same properties as this instance.\n *\n * @param {Paper} paper The paper to compare to.\n *\n * @returns {boolean} Whether the given paper is identical or not.\n */\n equals(paper) {\n return this._text === paper.getText() && isEqual(this._attributes, paper._attributes);\n }\n\n /**\n * Parses the object to a Paper.\n *\n * @param {Object|Paper} serialized The serialized object or Paper instance.\n *\n * @returns {Paper} The parsed Paper.\n */\n static parse(serialized) {\n // For ease of use, check if it is not already a Paper instance.\n if (serialized instanceof Paper) {\n return serialized;\n }\n\n // _parseClass is taken here, so it doesn't end up in the attributes.\n // eslint-disable-next-line no-unused-vars\n const {text, _parseClass, ...attributes} = serialized;\n\n return new Paper(text, attributes);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;A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K,KAAK4D,KAAK,CAACxC,OAAO,CAAC,CAAC,IAAI,IAAAyC,eAAO,EAAC,IAAI,CAACrD,WAAW,EAAEoD,KAAK,CAACpD,WAAW,CAAC;EACvF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAOsD,KAAKA,CAACC,UAAU,EAAE;IACvB;IACA,IAAIA,UAAU,YAAYnE,KAAK,EAAE;MAC/B,OAAOmE,UAAU;IACnB;;IAEA;IACA;IACA,MAAM;MAACjE,IAAI;MAAE4D,WAAW;MAAE,GAAG3D;IAAU,CAAC,GAAGgE,UAAU;IAErD,OAAO,IAAInE,KAAK,CAACE,IAAI,EAAEC,UAAU,CAAC;EACpC;AACF;AAACiE,OAAA,CAAAC,OAAA,GAAArE,KAAA","ignoreList":[]}
1
+ {"version":3,"file":"Paper.js","names":["_lodash","require","defaultAttributes","keyword","synonyms","description","title","titleWidth","titleCount","h1Count","slug","domain","locale","permalink","date","customData","textTitle","writingDirection","wpBlocks","isFrontPage","Paper","constructor","text","attributes","_text","_tree","defaults","hasOwnProperty","url","onlyLetters","replace","isEmpty","_attributes","hasKeyword","getKeyword","getAttributes","hasSynonyms","getSynonyms","hasH1Count","isNull","getH1Count","hasTitleCount","getTitleCount","hasText","getText","getDomain","setTree","tree","getTree","hasDescription","getDescription","hasTitle","getTitle","hasTitleWidth","getTitleWidth","hasSlug","hasShopSettings","shopSettings","getSlug","hasProductSchema","hasData","data","isObject","hasRelatedKeywords","relatedKeywords","related_keywords","Array","isArray","length","getData","getIgnoredAssessments","ignoredAssessments","getSkippedAssessments","skippedAssessments","getShopSettings","hasUrl","console","warn","getUrl","hasLocale","getLocale","getWritingDirection","hasPermalink","getPermalink","hasDate","getDate","hasCustomData","getCustomData","hasTextTitle","isNil","getTextTitle","serialize","_parseClass","equals","paper","isEqual","parse","serialized","exports","default"],"sources":["../../src/values/Paper.js"],"sourcesContent":["import {defaults, isEmpty, isEqual, isNil, isNull, isObject} from 'lodash';\n\n/**\n * Default attributes to be used by the Paper if they are left undefined.\n * @type {{keyword: string, synonyms: string, description: string, title: string, titleWidth: number,\n * \t\t slug: string, locale: string, permalink: string, date: string, customData: object, textTitle: string,\n * \t\t writingDirection: \"LTR\", isFrontPage: boolean }}\n */\nconst defaultAttributes = {\n keyword: '',\n synonyms: '',\n description: '',\n title: '',\n titleWidth: 0,\n titleCount: null,\n h1Count: null,\n slug: '',\n domain: '',\n locale: 'en_US',\n permalink: '',\n date: '',\n customData: {},\n textTitle: '',\n writingDirection: 'LTR',\n wpBlocks: [],\n isFrontPage: false\n};\n\n/**\n * Represents an object where the analysis data is stored.\n */\nexport default class Paper {\n /**\n * Constructs the Paper object and sets its attributes.\n *\n * @param {string} text The text to use in the analysis.\n * @param {object} [attributes] The object containing all attributes.\n * @param {string} [attributes.keyword] The main keyword or keyphrase of the text.\n * @param {string} [attributes.synonyms] The synonyms of the main keyword or keyphrase. It should be separated by commas if multiple synonyms are added.\n * @param {string} [attributes.description] The SEO meta description.\n * @param {string} [attributes.title] The SEO title.\n * @param {string} [attributes.domain] The shop domain.\n * @param {number|null} [attributes.titleCount=null] The title tag count value.\n * @param {number|null} [attributes.h1Count=null] The h1 tag count value.\n * @param {number} [attributes.titleWidth=0] The width of the title in pixels.\n * @param {string} [attributes.slug] The slug.\n * @param {string} [attributes.locale=en_US] The locale.\n * @param {string} [attributes.permalink] The full URL for any given post, page, or other pieces of content on a site.\n * @param {string} [attributes.date] The date.\n * @param {Object[]} [attributes.wpBlocks] The array of texts, encoded in WordPress block editor blocks.\n * @param {Object[]} [attributes.ignoredAssessments] The array of texts, show which assessments should be ignored.\n * @param {Object[]} [attributes.skippedAssessments] The array of texts, show which assessments should be skipped (those assessments will have good result).\n * @param {Object} [attributes.data] Given data.\n * @param {Object} [attributes.customData] Custom data.\n * @param {Object} [attributes.shopSettings] Shop's settings.\n * @param {string} [attributes.textTitle] The title of the text.\n * @param {string} [attributes.writingDirection=LTR] The writing direction of the paper. Defaults to left to right (LTR).\n * @param {boolean} [attributes.isFrontPage=false] Whether the current page is the front page of the site. Defaults to false.\n */\n constructor(text, attributes) {\n this._text = text || '';\n\n this._tree = null;\n\n attributes = attributes || {};\n defaults(attributes, defaultAttributes);\n\n if (attributes.locale === '') {\n attributes.locale = defaultAttributes.locale;\n }\n\n if (attributes.hasOwnProperty('url')) {\n attributes.slug = attributes.url || attributes.slug;\n }\n\n const onlyLetters = attributes.keyword.replace(\n /[‘’“”\"'.?!:;,¿¡«»&*@#±^%|~`[\\](){}⟨⟩<>/\\\\–\\-\\u2014\\u00d7\\u002b\\s]/g,\n ''\n );\n\n if (isEmpty(onlyLetters)) {\n attributes.keyword = defaultAttributes.keyword;\n }\n\n this._attributes = attributes;\n }\n\n /**\n * Checks whether a keyword is available.\n * @returns {boolean} Returns true if the Paper has a keyword.\n */\n hasKeyword() {\n return this._attributes.keyword !== '';\n }\n\n /**\n * Returns the associated keyword or an empty string if no keyword is available.\n * @returns {string} Returns Keyword\n */\n getKeyword() {\n return this._attributes.keyword;\n }\n\n /**\n *\n * @returns {*|{keyword?: string, synonyms?: string, description?: string, title?: string, titleCount?: (number|null), h1Count?: (number|null), titleWidth?: number, slug?: string, locale?: string, permalink?: string, date?: string, wpBlocks?: Object[], customData?: Object, textTitle?: string, writingDirection?: string, isFrontPage?: boolean}|{}|{}}\n */\n getAttributes() {\n return this._attributes;\n }\n\n /**\n * Checks whether synonyms are available.\n * @returns {boolean} Returns true if the Paper has synonyms.\n */\n hasSynonyms() {\n return this._attributes.synonyms !== '';\n }\n\n /**\n * Returns the associated synonyms or an empty string if no synonyms is available.\n * @returns {string} Returns synonyms.\n */\n getSynonyms() {\n return this._attributes.synonyms;\n }\n\n /**\n * Checks whether the h1 count value is available.\n * @returns {boolean} Returns true if the paper has a h1 count value.\n */\n hasH1Count() {\n return !isNull(this._attributes.h1Count);\n }\n\n /**\n * Returns the h1 tag count value.\n * @returns {number | null}\n */\n getH1Count() {\n return this._attributes.h1Count;\n }\n\n /**\n * Checks whether the title count value is available.\n * @returns {boolean} Returns true if the paper has a title count.\n */\n hasTitleCount() {\n return !isNull(this._attributes.titleCount);\n }\n\n /**\n * Returns the title count value.\n * @returns {number | null}\n */\n getTitleCount() {\n return this._attributes.titleCount;\n }\n\n /**\n * Checks whether the text is available.\n * @returns {boolean} Returns true if the paper has a text.\n */\n hasText() {\n return this._text !== '';\n }\n\n /**\n * Returns the associated text or an empty string if no text is available.\n * @returns {string} Returns the text.\n */\n getText() {\n return this._text;\n }\n\n /**\n * Returns the associated text or an empty string if no text is available.\n * @returns {string} Returns the text.\n */\n getDomain() {\n return this._attributes.domain;\n }\n\n /**\n * Sets the tree.\n *\n * @param {Node} tree The tree to set.\n *\n * @returns {void}\n */\n setTree(tree) {\n this._tree = tree;\n }\n\n /**\n * Returns the tree.\n *\n * @returns {Node} The tree.\n */\n getTree() {\n return this._tree;\n }\n\n /**\n * Checks whether a description is available.\n * @returns {boolean} Returns true if the paper has a description.\n */\n hasDescription() {\n return this._attributes.description !== '';\n }\n\n /**\n * Returns the description or an empty string if no description is available.\n * @returns {string} Returns the description.\n */\n getDescription() {\n return this._attributes.description;\n }\n\n /**\n * Checks whether an SEO title is available\n * @returns {boolean} Returns true if the Paper has an SEO title.\n */\n hasTitle() {\n return this._attributes.title !== '';\n }\n\n /**\n * Returns the SEO title, or an empty string if no title is available.\n * @returns {string} Returns the SEO title.\n */\n getTitle() {\n return this._attributes.title;\n }\n\n /**\n * Checks whether an SEO title width in pixels is available.\n * @returns {boolean} Returns true if the Paper's SEO title is wider than 0 pixels.\n */\n hasTitleWidth() {\n return this._attributes.titleWidth !== 0;\n }\n\n /**\n * Gets the SEO title width in pixels, or an empty string of no title width in pixels is available.\n * @returns {number} Returns the SEO title width in pixels.\n */\n getTitleWidth() {\n return this._attributes.titleWidth;\n }\n\n /**\n * Checks whether a slug is available.\n * @returns {boolean} Returns true if the Paper has a slug.\n */\n hasSlug() {\n return this._attributes.slug !== '';\n }\n\n /**\n * Checks whether a shop settings is available.\n * @returns {boolean} Returns true if the Paper has a shop settings.\n */\n hasShopSettings() {\n return !isEmpty(this._attributes?.shopSettings || {});\n }\n\n /**\n * Gets the paper's slug, or an empty string if no slug is available.\n * @returns {string} Returns the slug.\n */\n getSlug() {\n return this._attributes.slug;\n }\n\n /**\n *\n * @returns {(function(): *)|boolean}\n */\n hasProductSchema() {\n return this._attributes?.hasProductSchema || false;\n }\n\n /**\n *\n * @returns {(function(): *)|boolean}\n */\n hasData() {\n const data = this._attributes?.data;\n return isObject(data) && !isEmpty(data);\n }\n\n /**\n *\n * @returns {(function(): *)|boolean}\n */\n hasRelatedKeywords() {\n const relatedKeywords = this._attributes?.data?.related_keywords || [];\n return Array.isArray(relatedKeywords) && relatedKeywords.length > 0;\n }\n\n /**\n *\n * @returns {Object|{}}\n */\n getData() {\n return this._attributes?.data || {};\n }\n\n /**\n *\n * @returns {Object[String]|*[String]}\n */\n getIgnoredAssessments() {\n return this._attributes?.ignoredAssessments || [];\n }\n\n /**\n *\n * @returns {Object[String]|*[String]}\n */\n getSkippedAssessments() {\n return this._attributes?.skippedAssessments || [];\n }\n\n /**\n *\n * @returns {*|{}}\n */\n getShopSettings() {\n return this._attributes?.shopSettings || {};\n }\n\n /**\n * Checks if currently edited page is a front page.\n * @returns {boolean} Returns true if the current page is a front page.\n */\n isFrontPage() {\n return this._attributes.isFrontPage;\n }\n\n /**\n * Checks whether an url is available\n * @deprecated Since version 1.19.1. Use hasSlug instead.\n * @returns {boolean} Returns true if the Paper has a slug.\n */\n hasUrl() {\n console.warn('This function is deprecated, use hasSlug instead');\n return this.hasSlug();\n }\n\n /**\n * Returns the url, or an empty string if no url is available.\n * @deprecated Since version 1.19.1. Use getSlug instead.\n * @returns {string} Returns the url\n */\n getUrl() {\n console.warn('This function is deprecated, use getSlug instead');\n return this.getSlug();\n }\n\n /**\n * Checks whether a locale is available.\n * @returns {boolean} Returns true if the paper has a locale.\n */\n hasLocale() {\n return this._attributes.locale !== '';\n }\n\n /**\n * Returns the locale or an empty string if no locale is available\n * @returns {string} Returns the locale.\n */\n getLocale() {\n return this._attributes.locale;\n }\n\n /**\n * Gets the information of the writing direction of the paper.\n * It returns \"LTR\" (left to right) if this attribute is not provided.\n *\n * @returns {string} Returns the information of the writing direction of the paper.\n */\n getWritingDirection() {\n return this._attributes.writingDirection;\n }\n\n /**\n * Checks whether a permalink is available.\n * @returns {boolean} Returns true if the Paper has a permalink.\n */\n hasPermalink() {\n return this._attributes.permalink !== '';\n }\n\n /**\n * Returns the permalink, or an empty string if no permalink is available.\n * @returns {string} Returns the permalink.\n */\n getPermalink() {\n return this._attributes.permalink;\n }\n\n /**\n * Checks whether a date is available.\n * @returns {boolean} Returns true if the Paper has a date.\n */\n hasDate() {\n return this._attributes.date !== '';\n }\n\n /**\n * Returns the date, or an empty string if no date is available.\n * @returns {string} Returns the date.\n */\n getDate() {\n return this._attributes.date;\n }\n\n /**\n * Checks whether custom data is available.\n * @returns {boolean} Returns true if the Paper has custom data.\n */\n hasCustomData() {\n return !isEmpty(this._attributes.customData);\n }\n\n /**\n * Returns the custom data, or an empty object if no data is available.\n * @returns {Object} Returns the custom data.\n */\n getCustomData() {\n return this._attributes.customData;\n }\n\n /**\n * Checks whether a text title is available.\n * @returns {boolean} Returns true if the Paper has a text title.\n */\n hasTextTitle() {\n return this._attributes.textTitle !== '' && !isNil(this._attributes.textTitle);\n }\n\n /**\n * Returns the text title, or an empty string if no data is available.\n * @returns {string} Returns the text title.\n */\n getTextTitle() {\n return this._attributes.textTitle;\n }\n\n /**\n * Serializes the Paper instance to an object.\n *\n * @returns {Object} The serialized Paper.\n */\n serialize() {\n return {\n _parseClass: 'Paper',\n text: this._text,\n ...this._attributes\n };\n }\n\n /**\n * Checks whether the given paper has the same properties as this instance.\n *\n * @param {Paper} paper The paper to compare to.\n *\n * @returns {boolean} Whether the given paper is identical or not.\n */\n equals(paper) {\n return this._text === paper.getText() && isEqual(this._attributes, paper._attributes);\n }\n\n /**\n * Parses the object to a Paper.\n *\n * @param {Object|Paper} serialized The serialized object or Paper instance.\n *\n * @returns {Paper} The parsed Paper.\n */\n static parse(serialized) {\n // For ease of use, check if it is not already a Paper instance.\n if (serialized instanceof Paper) {\n return serialized;\n }\n\n // _parseClass is taken here, so it doesn't end up in the attributes.\n // eslint-disable-next-line no-unused-vars\n const {text, _parseClass, ...attributes} = serialized;\n\n return new Paper(text, attributes);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAG;EACxBC,OAAO,EAAE,EAAE;EACXC,QAAQ,EAAE,EAAE;EACZC,WAAW,EAAE,EAAE;EACfC,KAAK,EAAE,EAAE;EACTC,UAAU,EAAE,CAAC;EACbC,UAAU,EAAE,IAAI;EAChBC,OAAO,EAAE,IAAI;EACbC,IAAI,EAAE,EAAE;EACRC,MAAM,EAAE,EAAE;EACVC,MAAM,EAAE,OAAO;EACfC,SAAS,EAAE,EAAE;EACbC,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE,CAAC,CAAC;EACdC,SAAS,EAAE,EAAE;EACbC,gBAAgB,EAAE,KAAK;EACvBC,QAAQ,EAAE,EAAE;EACZC,WAAW,EAAE;AACf,CAAC;;AAED;AACA;AACA;AACe,MAAMC,KAAK,CAAC;EACzB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,IAAI,EAAEC,UAAU,EAAE;IAC5B,IAAI,CAACC,KAAK,GAAGF,IAAI,IAAI,EAAE;IAEvB,IAAI,CAACG,KAAK,GAAG,IAAI;IAEjBF,UAAU,GAAGA,UAAU,IAAI,CAAC,CAAC;IAC7B,IAAAG,gBAAQ,EAACH,UAAU,EAAErB,iBAAiB,CAAC;IAEvC,IAAIqB,UAAU,CAACX,MAAM,KAAK,EAAE,EAAE;M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7E,KAAK,CAACE,IAAI,EAAEC,UAAU,CAAC;EACpC;AACF;AAAC2E,OAAA,CAAAC,OAAA,GAAA/E,KAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axyseo",
3
- "version": "2.0.0-alpha.0.0.26",
3
+ "version": "2.0.0-alpha.0.0.28",
4
4
  "main": "build/index.js",
5
5
  "scripts": {
6
6
  "build": "yarn clean && yarn build:js && yarn build:types",