axyseo 2.0.0-alpha.0.0.24 → 2.0.0-alpha.0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/scoring/assessments/assessment.js +3 -0
- package/build/scoring/assessments/assessment.js.map +1 -1
- package/build/scoring/assessments/readability/ParagraphTooLongAssessment.js +1 -1
- package/build/scoring/assessments/readability/ParagraphTooLongAssessment.js.map +1 -1
- package/build/scoring/assessments/readability/SentenceBeginningsAssessment.js +4 -3
- package/build/scoring/assessments/readability/SentenceBeginningsAssessment.js.map +1 -1
- package/build/scoring/assessments/readability/SentenceLengthInTextAssessment.js +1 -2
- package/build/scoring/assessments/readability/SentenceLengthInTextAssessment.js.map +1 -1
- package/build/scoring/assessments/readability/TransitionWordsAssessment.js +1 -1
- package/build/scoring/assessments/readability/TransitionWordsAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/ImageCountAssessment.js +1 -1
- package/build/scoring/assessments/seo/ImageCountAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/InternalLinksAssessment.js +1 -1
- package/build/scoring/assessments/seo/InternalLinksAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/IntroductionKeywordAssessment.js +3 -3
- package/build/scoring/assessments/seo/IntroductionKeywordAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/KeyphraseAssessment.js +1 -1
- package/build/scoring/assessments/seo/KeyphraseAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/KeyphraseLengthAssessment.js +1 -1
- package/build/scoring/assessments/seo/KeyphraseLengthAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/KeywordDensityAssessment.js +2 -1
- package/build/scoring/assessments/seo/KeywordDensityAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/MetaDescriptionKeywordAssessment.js +1 -2
- package/build/scoring/assessments/seo/MetaDescriptionKeywordAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/MetaDescriptionLengthAssessment.js +1 -1
- package/build/scoring/assessments/seo/MetaDescriptionLengthAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/MetaTitleKeywordAssessment.js +1 -1
- package/build/scoring/assessments/seo/MetaTitleKeywordAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/NumberInMetaTitleAssessment.js +1 -1
- package/build/scoring/assessments/seo/NumberInMetaTitleAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/OutboundLinksAssessment.js +1 -1
- package/build/scoring/assessments/seo/OutboundLinksAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/PageTitleWidthAssessment.js +1 -1
- package/build/scoring/assessments/seo/PageTitleWidthAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/SchemaAssessment.js +4 -3
- package/build/scoring/assessments/seo/SchemaAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/SingleH1Assessment.js +1 -1
- package/build/scoring/assessments/seo/SingleH1Assessment.js.map +1 -1
- package/build/scoring/assessments/seo/SingleTitleAssessment.js +1 -1
- package/build/scoring/assessments/seo/SingleTitleAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/SubHeadingsKeywordAssessment.js +1 -2
- package/build/scoring/assessments/seo/SubHeadingsKeywordAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/TextImagesAssessment.js +1 -1
- package/build/scoring/assessments/seo/TextImagesAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/TextLengthAssessment.js +1 -1
- package/build/scoring/assessments/seo/TextLengthAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/UrlKeywordAssessment.js +1 -1
- package/build/scoring/assessments/seo/UrlKeywordAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/UrlLengthAssessment.js +1 -1
- package/build/scoring/assessments/seo/UrlLengthAssessment.js.map +1 -1
- package/build/scoring/assessors/assessor.js +26 -5
- package/build/scoring/assessors/assessor.js.map +1 -1
- package/build/scoring/assessors/seoAssessor.js +2 -1
- package/build/scoring/assessors/seoAssessor.js.map +1 -1
- package/build/values/Paper.js +9 -0
- package/build/values/Paper.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextImagesAssessment.js","names":["_lodash","require","_polaris","_react","_interopRequireDefault","_assessment","_AssessmentResult","_helpers","_polarisIcons","e","__esModule","default","TextImagesAssessment","Assessment","constructor","config","defaultConfig","id","ctaType","docUrl","fixPosition","icon","ExternalIcon","priority","title","content","good","improve","bad","identifier","_config","merge","getResult","paper","researcher","i18n","assessmentResult","AssessmentResult","altTagsProperties","getResearch","imageCount","calculatedResult","calculateResult","setScore","score","setStatus","status","setBody","body","imagesNoAlt","noAlt","getScore","createElement","Text","as","href","target","rel","fix","shop","data","console","log","altText","name","parser","DOMParser","doc","parseFromString","imgTags","querySelectorAll","forEach","img","hasAttribute","getAttribute","setAttribute","innerHTML","isApplicable","hasText","exports"],"sources":["../../../../src/scoring/assessments/seo/TextImagesAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport {Text} from '@shopify/polaris';\nimport React from 'react';\n\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {checkMissingAlt} from '../../../helpers';\nimport {ExternalIcon} from '@shopify/polaris-icons';\n\n/**\n * Represents the assessment that assesses the SEO title width and gives the feedback accordingly.\n */\nexport default class TextImagesAssessment 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: 'textImages',\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#alt-text',\n fixPosition: 'description',\n icon: ExternalIcon,\n priority: 'high',\n title: 'Alt text',\n content: {\n good: 'All images have descriptive and relevant alt text.',\n improve: '',\n bad: 'Missing alt text. Add descriptive alt text for accessibility and SEO.'\n }\n };\n\n this.identifier = 'textImages';\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the h1 research and based on this returns an assessment result with a score.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling the research.\n * @param i18n\n * @returns {AssessmentResult} The assessment result.\n */\n getResult({paper, researcher, i18n}) {\n const assessmentResult = new AssessmentResult({config: this._config});\n this.altTagsProperties = researcher.getResearch('altTagCount');\n this.imageCount = researcher.getResearch('imageCount');\n\n const calculatedResult = this.calculateResult(paper, i18n);\n\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n assessmentResult.setBody(calculatedResult.body);\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @param i18n\n * @returns {{score: number, body: React.JSX.Element, status: string}}\n */\n calculateResult(paper, i18n) {\n const imagesNoAlt = this.altTagsProperties.noAlt;\n\n let status = '';\n if (imagesNoAlt === this.imageCount || imagesNoAlt > 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 Learn more\n </a>\n )}\n </Text>\n )\n };\n }\n\n /**\n *\n * @param shop\n * @param data\n * @returns {string}\n */\n fix({shop, data}) {\n if (!shop) {\n console.log('Shop is missing');\n return data.body || '';\n }\n\n if (!data.body) {\n console.log('body is missing');\n return '';\n }\n\n const altText = shop?.name || 'Shop' + ' | ' + data?.title || 'Title';\n\n const parser = new DOMParser();\n const doc = parser.parseFromString(data.body, 'text/html');\n\n const imgTags = doc.querySelectorAll('img');\n\n imgTags.forEach(img => {\n if (!img.hasAttribute('alt') || img.getAttribute('alt') === '') {\n img.setAttribute('alt', altText);\n }\n });\n\n return doc.body.innerHTML;\n }\n\n /**\n * Checks whether the paper has a text.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param researcher\n * @returns {boolean} True when there is text.\n */\n isApplicable(paper, researcher) {\n this.imageCount = researcher.getResearch('imageCount');\n return paper.hasText() && this.imageCount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
+
{"version":3,"file":"TextImagesAssessment.js","names":["_lodash","require","_polaris","_react","_interopRequireDefault","_assessment","_AssessmentResult","_helpers","_polarisIcons","e","__esModule","default","TextImagesAssessment","Assessment","constructor","config","defaultConfig","id","ctaType","docUrl","fixPosition","icon","ExternalIcon","priority","title","content","good","improve","bad","identifier","_config","merge","getResult","paper","researcher","i18n","assessmentResult","AssessmentResult","altTagsProperties","getResearch","imageCount","calculatedResult","calculateResult","setScore","score","setStatus","status","setBody","body","imagesNoAlt","noAlt","getScore","createElement","Text","as","href","target","rel","translate","fix","shop","data","console","log","altText","name","parser","DOMParser","doc","parseFromString","imgTags","querySelectorAll","forEach","img","hasAttribute","getAttribute","setAttribute","innerHTML","isApplicable","hasText","exports"],"sources":["../../../../src/scoring/assessments/seo/TextImagesAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport {Text} from '@shopify/polaris';\nimport React from 'react';\n\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {checkMissingAlt} from '../../../helpers';\nimport {ExternalIcon} from '@shopify/polaris-icons';\n\n/**\n * Represents the assessment that assesses the SEO title width and gives the feedback accordingly.\n */\nexport default class TextImagesAssessment 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: 'textImages',\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#alt-text',\n fixPosition: 'description',\n icon: ExternalIcon,\n priority: 'high',\n title: 'Alt text',\n content: {\n good: 'All images have descriptive and relevant alt text.',\n improve: '',\n bad: 'Missing alt text. Add descriptive alt text for accessibility and SEO.'\n }\n };\n\n this.identifier = 'textImages';\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the h1 research and based on this returns an assessment result with a score.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling the research.\n * @param i18n\n * @returns {AssessmentResult} The assessment result.\n */\n getResult({paper, researcher, i18n}) {\n const assessmentResult = new AssessmentResult({config: this._config});\n this.altTagsProperties = researcher.getResearch('altTagCount');\n this.imageCount = researcher.getResearch('imageCount');\n\n const calculatedResult = this.calculateResult(paper, i18n);\n\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n assessmentResult.setBody(calculatedResult.body);\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @param i18n\n * @returns {{score: number, body: React.JSX.Element, status: string}}\n */\n calculateResult(paper, i18n) {\n const imagesNoAlt = this.altTagsProperties.noAlt;\n\n let status = '';\n if (imagesNoAlt === this.imageCount || imagesNoAlt > 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 shop\n * @param data\n * @returns {string}\n */\n fix({shop, data}) {\n if (!shop) {\n console.log('Shop is missing');\n return data.body || '';\n }\n\n if (!data.body) {\n console.log('body is missing');\n return '';\n }\n\n const altText = shop?.name || 'Shop' + ' | ' + data?.title || 'Title';\n\n const parser = new DOMParser();\n const doc = parser.parseFromString(data.body, 'text/html');\n\n const imgTags = doc.querySelectorAll('img');\n\n imgTags.forEach(img => {\n if (!img.hasAttribute('alt') || img.getAttribute('alt') === '') {\n img.setAttribute('alt', altText);\n }\n });\n\n return doc.body.innerHTML;\n }\n\n /**\n * Checks whether the paper has a text.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param researcher\n * @returns {boolean} True when there is text.\n */\n isApplicable(paper, researcher) {\n this.imageCount = researcher.getResearch('imageCount');\n return paper.hasText() && this.imageCount > 0;\n }\n}\n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AG,CAAC;EAC/C;AACF;AAACwC,OAAA,CAAArE,OAAA,GAAAC,oBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextLengthAssessment.js","names":["_lodash","require","_react","_interopRequireDefault","_polaris","_assessment","_AssessmentResult","_helpers","e","__esModule","default","TextLengthAssessment","Assessment","constructor","config","defaultConfig","id","ctaType","docUrl","priority","fixPosition","title","content","good","improve","bad","identifier","_config","merge","getResult","paper","researcher","i18n","calculatedResult","calculateResult","assessmentResult","AssessmentResult","setScore","score","setStatus","status","setBody","body","wordCount","charCount","countWordInHtml","getText","getScore","createElement","Text","as","href","target","rel","exports"],"sources":["../../../../src/scoring/assessments/seo/TextLengthAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport React from 'react';\nimport {Text} from '@shopify/polaris';\n\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {countWordInHtml} from '@axyseo/helpers';\n\n/**\n * Represents an assessment that checks the length of the text and gives feedback accordingly.\n */\nexport default class TextLengthAssessment 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: 'textLength',\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#text-length',\n priority: 'high',\n fixPosition: 'description',\n title: 'Text length',\n content: {\n good: 'Text length is optimized.',\n improve:\n 'Content length is acceptable, but could be expanded to 2,500 characters for more value.',\n bad:\n 'Insufficient content. Aim for at least 600 words to provide value and rank well in search results.'\n }\n };\n\n this.identifier = 'textLength';\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Executes the Assessment and returns a result.\n *\n * @param {Paper} paper The Paper object to assess.\n * @param {Researcher} researcher The Researcher object containing all available researches.\n *\n * @param i18n\n * @returns {AssessmentResult} The result of the assessment, containing both a score and a descriptive text.\n */\n getResult({paper, researcher, i18n}) {\n const calculatedResult = this.calculateResult(paper, i18n);\n\n const assessmentResult = new AssessmentResult({config: this._config});\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n assessmentResult.setBody(calculatedResult.body);\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @param i18n\n * @returns {{score: number, body: React.JSX.Element, status: string}}\n */\n calculateResult(paper, i18n) {\n const {wordCount, charCount} = countWordInHtml(paper.getText(), true);\n let status = 'bad';\n if (charCount < 2500 && wordCount >= 600) {\n status = 'improve';\n }\n if (wordCount < 600 && charCount < 2500) {\n status = 'bad';\n }\n if (charCount >= 2500 && wordCount >= 600) {\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 Learn more\n </a>\n )}\n </Text>\n )\n };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,iBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAAgD,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhD;AACA;AACA;AACe,MAAMG,oBAAoB,SAASC,mBAAU,CAAC;EAC3D;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,YAAY;MAChBC,OAAO,EAAE,KAAK;MACdC,MAAM,EACJ,yF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,IAAII,SAAS,IAAI,IAAI,IAAID,SAAS,IAAI,GAAG,EAAE;MACzCH,MAAM,GAAG,MAAM;IACjB;IAEA,MAAMF,KAAK,GAAG,IAAI,CAACS,QAAQ,CAAC,IAAI,CAACpB,OAAO,CAACR,QAAQ,EAAEqB,MAAM,CAAC;IAE1D,OAAO;MACLF,KAAK;MACLE,MAAM;MACNE,IAAI,eACFxC,MAAA,CAAAQ,OAAA,CAAAsC,aAAA,CAAC5C,QAAA,CAAA6C,IAAI;QAACC,EAAE,EAAE;MAAO,GACd,IAAI,CAACvB,OAAO,CAACL,OAAO,CAACkB,MAAM,CAAC,EAAE,GAAG,EACjC,IAAI,CAACb,OAAO,CAACT,MAAM,iBAClBhB,MAAA,CAAAQ,OAAA,CAAAsC,aAAA;QAAGG,IAAI,EAAE,IAAI,CAACxB,OAAO,CAACT,MAAO;QAACkC,MAAM,EAAC,QAAQ;QAACC,GAAG,EAAC;MAAY,
|
|
1
|
+
{"version":3,"file":"TextLengthAssessment.js","names":["_lodash","require","_react","_interopRequireDefault","_polaris","_assessment","_AssessmentResult","_helpers","e","__esModule","default","TextLengthAssessment","Assessment","constructor","config","defaultConfig","id","ctaType","docUrl","priority","fixPosition","title","content","good","improve","bad","identifier","_config","merge","getResult","paper","researcher","i18n","calculatedResult","calculateResult","assessmentResult","AssessmentResult","setScore","score","setStatus","status","setBody","body","wordCount","charCount","countWordInHtml","getText","getScore","createElement","Text","as","href","target","rel","translate","exports"],"sources":["../../../../src/scoring/assessments/seo/TextLengthAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport React from 'react';\nimport {Text} from '@shopify/polaris';\n\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {countWordInHtml} from '@axyseo/helpers';\n\n/**\n * Represents an assessment that checks the length of the text and gives feedback accordingly.\n */\nexport default class TextLengthAssessment 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: 'textLength',\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#text-length',\n priority: 'high',\n fixPosition: 'description',\n title: 'Text length',\n content: {\n good: 'Text length is optimized.',\n improve:\n 'Content length is acceptable, but could be expanded to 2,500 characters for more value.',\n bad:\n 'Insufficient content. Aim for at least 600 words to provide value and rank well in search results.'\n }\n };\n\n this.identifier = 'textLength';\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Executes the Assessment and returns a result.\n *\n * @param {Paper} paper The Paper object to assess.\n * @param {Researcher} researcher The Researcher object containing all available researches.\n *\n * @param i18n\n * @returns {AssessmentResult} The result of the assessment, containing both a score and a descriptive text.\n */\n getResult({paper, researcher, i18n}) {\n const calculatedResult = this.calculateResult(paper, i18n);\n\n const assessmentResult = new AssessmentResult({config: this._config});\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n assessmentResult.setBody(calculatedResult.body);\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @param i18n\n * @returns {{score: number, body: React.JSX.Element, status: string}}\n */\n calculateResult(paper, i18n) {\n const {wordCount, charCount} = countWordInHtml(paper.getText(), true);\n let status = 'bad';\n if (charCount < 2500 && wordCount >= 600) {\n status = 'improve';\n }\n if (wordCount < 600 && charCount < 2500) {\n status = 'bad';\n }\n if (charCount >= 2500 && wordCount >= 600) {\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"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,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AA7C,OAAA,GAAAC,oBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UrlKeywordAssessment.js","names":["_react","_interopRequireDefault","require","_polaris","_lodash","_assessment","_AssessmentResult","e","__esModule","default","SlugKeywordAssessment","Assessment","constructor","config","defaultConfig","id","docUrl","fixPosition","ctaType","priority","title","content","good","improve","bad","identifier","_config","merge","getResult","paper","researcher","i18n","_keywordInSlug","getResearch","assessmentResult","AssessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","setBody","body","isApplicable","isFrontPage","hasKeyword","hasSlug","hasResearch","keyphraseLength","percentWordMatches","getScore","createElement","Text","as","href","target","rel","_default","exports"],"sources":["../../../../src/scoring/assessments/seo/UrlKeywordAssessment.js"],"sourcesContent":["import React from 'react';\nimport {Text} from '@shopify/polaris';\nimport {merge} from 'lodash';\n\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\n\n/**\n * Represents the Slug keyword assessment. This assessment checks if the keyword is present in the slug.\n */\nclass SlugKeywordAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} config The configuration to use.\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: 'slugKeyword',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#keyword-in-url',\n fixPosition: 'url handle',\n ctaType: 'fix',\n priority: 'medium',\n title: 'Keyword in URL',\n content: {\n good: 'Keyword is included in URL.',\n improve: '',\n bad: 'Missing keyword in URL. Include it for relevance and better SEO.'\n }\n };\n\n this.identifier = 'slugKeyword';\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Executes the Assessment and returns a result.\n *\n * @param {Paper} paper The Paper object to assess.\n * @param {Researcher} researcher The Researcher object containing all available researches.\n *\n * @param i18n\n * @returns {AssessmentResult} The result of the assessment, containing both a score and a descriptive text.\n */\n getResult({paper, researcher, i18n}) {\n this._keywordInSlug = researcher.getResearch('keywordCountInSlug');\n\n const assessmentResult = new AssessmentResult({config: this._config});\n\n const calculatedResult = this.calculateResult(i18n);\n\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n assessmentResult.setBody(calculatedResult.body);\n return assessmentResult;\n }\n\n /**\n * Checks whether the paper has a keyword and a slug.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} True if the paper contains a keyword and a slug, and if the keywordCountInSlug research is available on the researcher.\n */\n isApplicable(paper, researcher) {\n return (\n !paper.isFrontPage() &&\n paper.hasKeyword() &&\n paper.hasSlug() &&\n researcher.hasResearch('keywordCountInSlug')\n );\n }\n\n /**\n *\n * @param i18n\n * @returns {{score: number, body: React.JSX.Element, status: string}}\n */\n calculateResult(i18n) {\n const status = (() => {\n if (this._keywordInSlug.keyphraseLength < 3) {\n return this._keywordInSlug.percentWordMatches === 100 ? 'good' : 'bad';\n }\n return this._keywordInSlug.percentWordMatches > 50 ? 'good' : 'bad';\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 Learn more\n </a>\n )}\n </Text>\n )\n };\n }\n}\n\nexport default SlugKeywordAssessment;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAgE,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhE;AACA;AACA;AACA,MAAMG,qBAAqB,SAASC,mBAAU,CAA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AU,CAAC,CAAC,IAClBjB,KAAK,CAACkB,OAAO,CAAC,CAAC,IACfjB,UAAU,CAACkB,WAAW,CAAC,oBAAoB,CAAC;EAEhD;;EAEA;AACF;AACA;AACA;AACA;EACEX,eAAeA,CAACN,IAAI,EAAE;IACpB,MAAMU,MAAM,GAAG,CAAC,MAAM;MACpB,IAAI,IAAI,CAACT,cAAc,CAACiB,eAAe,GAAG,CAAC,EAAE;QAC3C,OAAO,IAAI,CAACjB,cAAc,CAACkB,kBAAkB,KAAK,GAAG,GAAG,MAAM,GAAG,KAAK;MACxE;MACA,OAAO,IAAI,CAAClB,cAAc,CAACkB,kBAAkB,GAAG,EAAE,GAAG,MAAM,GAAG,KAAK;IACrE,CAAC,EAAE,CAAC;IAEJ,MAAMX,KAAK,GAAG,IAAI,CAACY,QAAQ,CAAC,IAAI,CAACzB,OAAO,CAACP,QAAQ,EAAEsB,MAAM,CAAC;IAE1D,OAAO;MACLF,KAAK;MACLE,MAAM;MACNE,IAAI,eACF3C,MAAA,CAAAS,OAAA,CAAA2C,aAAA,CAACjD,QAAA,CAAAkD,IAAI;QAACC,EAAE,EAAE;MAAO,GACd,IAAI,CAAC5B,OAAO,CAACL,OAAO,CAACoB,MAAM,CAAC,EAAE,GAAG,EACjC,IAAI,CAACf,OAAO,CAACV,MAAM,iBAClBhB,MAAA,CAAAS,OAAA,CAAA2C,aAAA;QAAGG,IAAI,EAAE,IAAI,CAAC7B,OAAO,CAACV,MAAO;QAACwC,MAAM,EAAC,QAAQ;QAACC,GAAG,EAAC;MAAY,
|
|
1
|
+
{"version":3,"file":"UrlKeywordAssessment.js","names":["_react","_interopRequireDefault","require","_polaris","_lodash","_assessment","_AssessmentResult","e","__esModule","default","SlugKeywordAssessment","Assessment","constructor","config","defaultConfig","id","docUrl","fixPosition","ctaType","priority","title","content","good","improve","bad","identifier","_config","merge","getResult","paper","researcher","i18n","_keywordInSlug","getResearch","assessmentResult","AssessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","setBody","body","isApplicable","isFrontPage","hasKeyword","hasSlug","hasResearch","keyphraseLength","percentWordMatches","getScore","createElement","Text","as","href","target","rel","translate","_default","exports"],"sources":["../../../../src/scoring/assessments/seo/UrlKeywordAssessment.js"],"sourcesContent":["import React from 'react';\nimport {Text} from '@shopify/polaris';\nimport {merge} from 'lodash';\n\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\n\n/**\n * Represents the Slug keyword assessment. This assessment checks if the keyword is present in the slug.\n */\nclass SlugKeywordAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} config The configuration to use.\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: 'slugKeyword',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#keyword-in-url',\n fixPosition: 'url handle',\n ctaType: 'fix',\n priority: 'medium',\n title: 'Keyword in URL',\n content: {\n good: 'Keyword is included in URL.',\n improve: '',\n bad: 'Missing keyword in URL. Include it for relevance and better SEO.'\n }\n };\n\n this.identifier = 'slugKeyword';\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Executes the Assessment and returns a result.\n *\n * @param {Paper} paper The Paper object to assess.\n * @param {Researcher} researcher The Researcher object containing all available researches.\n *\n * @param i18n\n * @returns {AssessmentResult} The result of the assessment, containing both a score and a descriptive text.\n */\n getResult({paper, researcher, i18n}) {\n this._keywordInSlug = researcher.getResearch('keywordCountInSlug');\n\n const assessmentResult = new AssessmentResult({config: this._config});\n\n const calculatedResult = this.calculateResult(i18n);\n\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n assessmentResult.setBody(calculatedResult.body);\n return assessmentResult;\n }\n\n /**\n * Checks whether the paper has a keyword and a slug.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} True if the paper contains a keyword and a slug, and if the keywordCountInSlug research is available on the researcher.\n */\n isApplicable(paper, researcher) {\n return (\n !paper.isFrontPage() &&\n paper.hasKeyword() &&\n paper.hasSlug() &&\n researcher.hasResearch('keywordCountInSlug')\n );\n }\n\n /**\n *\n * @param i18n\n * @returns {{score: number, body: React.JSX.Element, status: string}}\n */\n calculateResult(i18n) {\n const status = (() => {\n if (this._keywordInSlug.keyphraseLength < 3) {\n return this._keywordInSlug.percentWordMatches === 100 ? 'good' : 'bad';\n }\n return this._keywordInSlug.percentWordMatches > 50 ? 'good' : 'bad';\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\nexport default SlugKeywordAssessment;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAgE,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhE;AACA;AACA;AACA,MAAMG,qBAAqB,SAASC,mBAAU,CAAC;EAC7C;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAE,aAAa;MACjBC,MAAM,EACJ,4FAA4F;MAC9FC,WAAW,EAAE,YAAY;MACzBC,OAAO,EAAE,KAAK;MACdC,QAAQ,EAAE,QAAQ;MAClBC,KAAK,EAAE,gBAA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ACjB,cAAc,CAACkB,kBAAkB,KAAK,GAAG,GAAG,MAAM,GAAG,KAAK;MACxE;MACA,OAAO,IAAI,CAAClB,cAAc,CAACkB,kBAAkB,GAAG,EAAE,GAAG,MAAM,GAAG,KAAK;IACrE,CAAC,EAAE,CAAC;IAEJ,MAAMX,KAAK,GAAG,IAAI,CAACY,QAAQ,CAAC,IAAI,CAACzB,OAAO,CAACP,QAAQ,EAAEsB,MAAM,CAAC;IAE1D,OAAO;MACLF,KAAK;MACLE,MAAM;MACNE,IAAI,eACF3C,MAAA,CAAAS,OAAA,CAAA2C,aAAA,CAACjD,QAAA,CAAAkD,IAAI;QAACC,EAAE,EAAE;MAAO,GACd,IAAI,CAAC5B,OAAO,CAACL,OAAO,CAACoB,MAAM,CAAC,EAAE,GAAG,EACjC,IAAI,CAACf,OAAO,CAACV,MAAM,iBAClBhB,MAAA,CAAAS,OAAA,CAAA2C,aAAA;QAAGG,IAAI,EAAE,IAAI,CAAC7B,OAAO,CAACV,MAAO;QAACwC,MAAM,EAAC,QAAQ;QAACC,GAAG,EAAC;MAAY,GAC3D1B,IAAI,GAAGA,IAAI,CAAC2B,SAAS,CAAC,yBAAyB,CAAC,GAAG,YACnD,CAED;IAEV,CAAC;EACH;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAEcC,qBAAqB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UrlLengthAssessment.js","names":["_lodash","require","_react","_interopRequireDefault","_polaris","_AssessmentResult","_assessment","e","__esModule","default","UrlLengthAssessment","Assessment","constructor","config","defaultConfig","id","priority","docUrl","fixPosition","ctaType","title","content","good","improve","bad","identifier","_config","merge","calculateResult","paper","i18n","status","length","getDomain","getSlug","score","getScore","body","createElement","Text","as","href","target","rel","getResult","researcher","calculatedResult","assessmentResult","AssessmentResult","setStatus","setBody","isApplicable","exports"],"sources":["../../../../src/scoring/assessments/seo/UrlLengthAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport React from 'react';\nimport {Text} from '@shopify/polaris';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport Assessment from '../assessment';\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 UrlLengthAssessment 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: 'urlLength',\n priority: 'high',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#url-length',\n fixPosition: 'url handle',\n ctaType: 'fix',\n title: 'URL length',\n content: {\n good: 'URL length is optimized, less than 75 characters.',\n improve: '',\n bad: 'Keep it less than 75 characters for better readability and SEO.'\n }\n };\n\n this.identifier = 'urlLength';\n this._config = merge(defaultConfig, config);\n }\n\n /**\n *\n * @param paper\n * @param i18n\n * @returns {{score: number, body: React.JSX.Element, status: string}}\n */\n calculateResult(paper, i18n) {\n let status = '';\n const length = paper.getDomain().length + paper.getSlug().length + 11;\n\n if (length < 75) {\n status = 'good';\n } else {\n status = 'bad';\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 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 calculatedResult = this.calculateResult(paper, i18n);\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 true;\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;AAAuC,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEvC;AACA;AACA;AACe,MAAMG,mBAAmB,SAASC,mBAAU,CAAC;EAC1D;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,WAAW;MACfC,QAAQ,EAAE,MAAM;MAChBC,MAAM,EACJ,wFAAwF;MAC1FC,WAAW,EAAE,YAAY;MACzBC,OAAO,EAAE,KAAK;MACdC,KAAK,EAAE,YAAY;MACnBC,OAAO,EAAE;QACPC,IAAI,EAAE,mDAAmD;QACzDC,OAAO,EAAE,EAAE;QACXC,GAAG,EAAE;MACP;IACF,CAAC;IAED,IAAI,CAACC,UAAU,GAAG,WAAW;IAC7B,IAAI,CAACC,OAAO,GAAG,IAAAC,aAAK,EAACb,aAAa,EAAED,MAAM,CAAC;EAC7C;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEe,eAAeA,CAACC,KAAK,EAAEC,IAAI,EAAE;IAC3B,IAAIC,MAAM,GAAG,EAAE;IACf,MAAMC,MAAM,GAAGH,KAAK,CAACI,SAAS,CAAC,CAAC,CAACD,MAAM,GAAGH,KAAK,CAACK,OAAO,CAAC,CAAC,CAACF,MAAM,GAAG,EAAE;IAErE,IAAIA,MAAM,GAAG,EAAE,EAAE;MACfD,MAAM,GAAG,MAAM;IACjB,CAAC,MAAM;MACLA,MAAM,GAAG,KAAK;IAChB;IAEA,MAAMI,KAAK,GAAG,IAAI,CAACC,QAAQ,CAAC,IAAI,CAACV,OAAO,CAACV,QAAQ,EAAEe,MAAM,CAAC;IAE1D,OAAO;MACLI,KAAK;MACLJ,MAAM;MACNM,IAAI,eACFnC,MAAA,CAAAO,OAAA,CAAA6B,aAAA,CAAClC,QAAA,CAAAmC,IAAI;QAACC,EAAE,EAAE;MAAO,GACd,IAAI,CAACd,OAAO,CAACL,OAAO,CAACU,MAAM,CAAC,EAAE,GAAG,EACjC,IAAI,CAACL,OAAO,CAACT,MAAM,iBAClBf,MAAA,CAAAO,OAAA,CAAA6B,aAAA;QAAGG,IAAI,EAAE,IAAI,CAACf,OAAO,CAACT,MAAO;QAACyB,MAAM,EAAC,QAAQ;QAACC,GAAG,EAAC;MAAY,
|
|
1
|
+
{"version":3,"file":"UrlLengthAssessment.js","names":["_lodash","require","_react","_interopRequireDefault","_polaris","_AssessmentResult","_assessment","e","__esModule","default","UrlLengthAssessment","Assessment","constructor","config","defaultConfig","id","priority","docUrl","fixPosition","ctaType","title","content","good","improve","bad","identifier","_config","merge","calculateResult","paper","i18n","status","length","getDomain","getSlug","score","getScore","body","createElement","Text","as","href","target","rel","translate","getResult","researcher","calculatedResult","assessmentResult","AssessmentResult","setStatus","setBody","isApplicable","exports"],"sources":["../../../../src/scoring/assessments/seo/UrlLengthAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport React from 'react';\nimport {Text} from '@shopify/polaris';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport Assessment from '../assessment';\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 UrlLengthAssessment 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: 'urlLength',\n priority: 'high',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#url-length',\n fixPosition: 'url handle',\n ctaType: 'fix',\n title: 'URL length',\n content: {\n good: 'URL length is optimized, less than 75 characters.',\n improve: '',\n bad: 'Keep it less than 75 characters for better readability and SEO.'\n }\n };\n\n this.identifier = 'urlLength';\n this._config = merge(defaultConfig, config);\n }\n\n /**\n *\n * @param paper\n * @param i18n\n * @returns {{score: number, body: React.JSX.Element, status: string}}\n */\n calculateResult(paper, i18n) {\n let status = '';\n const length = paper.getDomain().length + paper.getSlug().length + 11;\n\n if (length < 75) {\n status = 'good';\n } else {\n status = 'bad';\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 calculatedResult = this.calculateResult(paper, i18n);\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 true;\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,sBAA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AClC,QAAA,CAAAmC,IAAI;QAACC,EAAE,EAAE;MAAO,GACd,IAAI,CAACd,OAAO,CAACL,OAAO,CAACU,MAAM,CAAC,EAAE,GAAG,EACjC,IAAI,CAACL,OAAO,CAACT,MAAM,iBAClBf,MAAA,CAAAO,OAAA,CAAA6B,aAAA;QAAGG,IAAI,EAAE,IAAI,CAACf,OAAO,CAACT,MAAO;QAACyB,MAAM,EAAC,QAAQ;QAACC,GAAG,EAAC;MAAY,GAC3Db,IAAI,GAAGA,IAAI,CAACc,SAAS,CAAC,yBAAyB,CAAC,GAAG,YACnD,CAED;IAEV,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,SAASA,CAAC;IAAChB,KAAK;IAAEiB,UAAU;IAAEhB;EAAI,CAAC,EAAE;IACnC,MAAMiB,gBAAgB,GAAG,IAAI,CAACnB,eAAe,CAACC,KAAK,EAAEC,IAAI,CAAC;IAC1D,MAAMkB,gBAAgB,GAAG,IAAIC,yBAAgB,CAAC;MAACpC,MAAM,EAAE,IAAI,CAACa;IAAO,CAAC,CAAC;IAErEsB,gBAAgB,CAACE,SAAS,CAACH,gBAAgB,CAAChB,MAAM,CAAC;IACnDiB,gBAAgB,CAACE,SAAS,CAACH,gBAAgB,CAAChB,MAAM,CAAC;IACnDiB,gBAAgB,CAACG,OAAO,CAACJ,gBAAgB,CAACV,IAAI,CAAC;IAE/C,OAAOW,gBAAgB;EACzB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEI,YAAYA,CAACvB,KAAK,EAAEiB,UAAU,EAAE;IAC9B,OAAO,IAAI;EACb;AACF;AAACO,OAAA,CAAA5C,OAAA,GAAAC,mBAAA","ignoreList":[]}
|
|
@@ -10,6 +10,8 @@ var _build = require("../../parse/build");
|
|
|
10
10
|
var _LanguageProcessor = _interopRequireDefault(require("../../parse/language/LanguageProcessor.js"));
|
|
11
11
|
var _missingArgument = _interopRequireDefault(require("../../errors/missingArgument.js"));
|
|
12
12
|
var _errors = require("../../helpers/errors.js");
|
|
13
|
+
var _polaris = require("@shopify/polaris");
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
16
|
// External dependencies.
|
|
15
17
|
|
|
@@ -154,11 +156,30 @@ class Assessor {
|
|
|
154
156
|
bad: i18n.translate(`Axyseo.${assessment._config.id}.bad`)
|
|
155
157
|
};
|
|
156
158
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
const skippedAssessments = paper.getSkippedAssessments();
|
|
160
|
+
if (skippedAssessments.includes(assessment._config.id)) {
|
|
161
|
+
const assessmentResult = new _AssessmentResult.default({
|
|
162
|
+
config: assessment._config
|
|
163
|
+
});
|
|
164
|
+
const score = assessment.getScore(assessment._config.priority, 'good');
|
|
165
|
+
assessmentResult.setScore(score);
|
|
166
|
+
assessmentResult.setStatus('good');
|
|
167
|
+
assessmentResult.setTitle(assessment._config.title);
|
|
168
|
+
assessmentResult.setBody(/*#__PURE__*/_react.default.createElement(_polaris.Text, {
|
|
169
|
+
as: 'span'
|
|
170
|
+
}, assessment._config.content.good, ' ', assessment._config.docUrl && /*#__PURE__*/_react.default.createElement("a", {
|
|
171
|
+
href: assessment._config.docUrl,
|
|
172
|
+
target: "_blank",
|
|
173
|
+
rel: "noreferrer"
|
|
174
|
+
}, i18n ? i18n.translate(`Axyseo.Button.learnMore`) : 'Learn more')));
|
|
175
|
+
result = assessmentResult;
|
|
176
|
+
} else {
|
|
177
|
+
result = assessment.getResult({
|
|
178
|
+
paper,
|
|
179
|
+
researcher,
|
|
180
|
+
i18n
|
|
181
|
+
});
|
|
182
|
+
}
|
|
162
183
|
result.setIdentifier(assessment._config.id);
|
|
163
184
|
} catch (assessmentError) {
|
|
164
185
|
(0, _errors.showTrace)(assessmentError);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assessor.js","names":["_lodash","require","_AssessmentResult","_interopRequireDefault","_build","_LanguageProcessor","_missingArgument","_errors","e","__esModule","default","ScoreRating","Assessor","constructor","researcher","config","type","setResearcher","_assessments","isUndefined","MissingArgument","_researcher","getAvailableAssessments","isApplicable","assessment","paper","ignoreAssessments","getIgnoredAssessments","includes","_config","id","hasOwnProperty","hasMarker","isFunction","marker","getMarks","getSpecificMarker","getPaper","_lastPaper","assess","i18n","setPaper","languageProcessor","LanguageProcessor","shortcodes","_attributes","setTree","build","assessments","results","filter","bind","map","executeAssessment","result","title","translate","content","good","improve","bad","getResult","setIdentifier","assessmentError","showTrace","AssessmentResult","setScore","getValidResults","isValidResult","assessmentResult","hasScore","hasText","calculateOverallScore","totalScore","reduce","total","getScore","Math","round","length","addAssessment","name","identifier","getAssessment","removeAssessment","push","toDelete","findIndex","splice","find","getApplicableAssessments","availableAssessments","availableAssessment","_default","exports"],"sources":["../../../src/scoring/assessors/assessor.js"],"sourcesContent":["// External dependencies.\nimport {filter, find, findIndex, isFunction, isUndefined, map} from 'lodash';\n\n// Internal dependencies.\nimport AssessmentResult from '../../values/AssessmentResult.js';\nimport {build} from '../../parse/build';\nimport LanguageProcessor from '../../parse/language/LanguageProcessor.js';\nimport MissingArgument from '../../errors/missingArgument.js';\nimport {showTrace} from '../../helpers/errors.js';\n\n// The maximum score of individual assessment is 9. This is why we set the \"score rating\" here to 9.\nconst ScoreRating = 9;\n\n/**\n * The Assessor is a base class for all assessors.\n */\nclass Assessor {\n /**\n * Creates a new Assessor instance.\n * @param {Researcher}\tresearcher\tThe researcher to use.\n * @param {Object}\t\t[config]\tThe assessor config.\n */\n constructor(researcher, config) {\n this.type = 'assessor';\n this.setResearcher(researcher);\n this._assessments = [];\n }\n\n /**\n * Checks if the researcher is defined and sets it.\n *\n * @param {Researcher} researcher The researcher to use in the assessor.\n *\n * @throws {MissingArgument} Parameter needs to be a valid researcher object.\n * @returns {void}\n */\n setResearcher(researcher) {\n if (isUndefined(researcher)) {\n throw new MissingArgument('The assessor requires a researcher.');\n }\n this._researcher = researcher;\n }\n\n /**\n * Gets all available assessments.\n * @returns {Assessment[]} assessment\n */\n getAvailableAssessments() {\n return this._assessments;\n }\n\n /**\n * Checks whether the Assessment is applicable.\n *\n * @param {Assessment} assessment The Assessment object that needs to be checked.\n * @param {Paper} paper The Paper object to check against.\n * @param {Researcher} [researcher] The Researcher object containing additional information.\n * @returns {boolean} Whether or not the Assessment is applicable.\n */\n isApplicable(assessment, paper, researcher) {\n const ignoreAssessments = paper.getIgnoredAssessments();\n\n if (ignoreAssessments.includes(assessment._config.id)) {\n return false;\n }\n\n if (\n assessment.hasOwnProperty('isApplicable') ||\n typeof assessment.isApplicable === 'function'\n ) {\n return assessment.isApplicable(paper, researcher);\n }\n\n return true;\n }\n\n /**\n * Determines whether an assessment has a marker.\n *\n * @param {Assessment} assessment The assessment to check for.\n * @returns {boolean} Whether or not the assessment has a marker.\n */\n hasMarker(assessment) {\n return (\n isFunction(this._config.marker) &&\n (assessment.hasOwnProperty('getMarks') || typeof assessment.getMarks === 'function')\n );\n }\n\n /**\n * Returns the specific marker for this assessor.\n *\n * @returns {Function} The specific marker for this assessor.\n */\n getSpecificMarker() {\n return this._config.marker;\n }\n\n /**\n * Returns the paper that was most recently assessed.\n *\n * @returns {Paper} The paper that was most recently assessed.\n */\n getPaper() {\n return this._lastPaper;\n }\n\n /**\n * Runs the researches defined in the task list or the default researches.\n *\n * @param {Paper} paper The paper to run assessments on.\n * @param i18n\n * @returns {void}\n */\n assess(paper, i18n) {\n this._researcher.setPaper(paper);\n\n const languageProcessor = new LanguageProcessor(this._researcher);\n const shortcodes = paper._attributes && paper._attributes.shortcodes;\n paper.setTree(build(paper, languageProcessor, shortcodes));\n\n let assessments = this.getAvailableAssessments();\n this.results = [];\n\n assessments = filter(\n assessments,\n function(assessment) {\n return this.isApplicable(assessment, paper, this._researcher);\n }.bind(this)\n );\n\n this.results = map(assessments, assessment =>\n this.executeAssessment({\n paper,\n researcher: this._researcher,\n assessment,\n i18n\n })\n );\n this._lastPaper = paper;\n }\n\n /**\n * Executes an assessment and returns the AssessmentResult.\n *\n * @param {Paper} paper The paper to pass to the assessment.\n * @param {Researcher} researcher The researcher to pass to the assessment.\n * @param {Assessment} assessment The assessment to execute.\n * @param i18n\n * @returns {AssessmentResult} The result of the assessment.\n */\n executeAssessment({paper, researcher, assessment, i18n}) {\n let result;\n\n try {\n if (i18n) {\n assessment._config.title = i18n.translate(`Axyseo.${assessment._config.id}.title`);\n assessment._config.content = {\n good: i18n.translate(`Axyseo.${assessment._config.id}.good`),\n improve: i18n.translate(`Axyseo.${assessment._config.id}.improve`),\n bad: i18n.translate(`Axyseo.${assessment._config.id}.bad`)\n };\n }\n result = assessment.getResult({paper, researcher, i18n});\n result.setIdentifier(assessment._config.id);\n } catch (assessmentError) {\n showTrace(assessmentError);\n\n result = new AssessmentResult();\n\n result.setScore(-1);\n }\n return result;\n }\n\n /**\n * Filters out all assessment results that have no score and no text.\n *\n * @returns {AssessmentResult[]} The array with all the valid assessments.\n */\n getValidResults() {\n return filter(\n this.results,\n function(result) {\n return this.isValidResult(result);\n }.bind(this)\n );\n }\n\n /**\n * Returns if an assessmentResult is valid.\n *\n * @param {AssessmentResult} assessmentResult The assessmentResult to validate.\n * @returns {boolean} whether or not the result is valid.\n */\n isValidResult(assessmentResult) {\n return assessmentResult.hasScore() && assessmentResult.hasText();\n }\n\n /**\n * Returns the overall score. Calculates the total score by adding all scores and dividing these\n * by the number of results times the ScoreRating.\n *\n * @returns {number} The overall score.\n */\n calculateOverallScore() {\n const results = this.getValidResults();\n\n const totalScore = results.reduce(\n (total, assessmentResult) => total + assessmentResult.getScore(),\n 0\n );\n\n return Math.round((totalScore / (results.length * ScoreRating)) * 100) || 0;\n }\n\n /**\n * Registers an assessment and adds it to the internal assessments object.\n *\n * @param {string} name The name of the assessment.\n * @param {Assessment} assessment The object containing function to run as an assessment and it's requirements.\n * @returns {boolean} Whether registering the assessment was successful.\n */\n addAssessment(name, assessment) {\n if (!assessment.hasOwnProperty('identifier')) {\n assessment.identifier = name;\n }\n // If the assessor already has the same assessment, remove it and replace it with the new assessment with the same identifier.\n if (this.getAssessment(assessment.identifier)) {\n this.removeAssessment(assessment.identifier);\n }\n\n this._assessments.push(assessment);\n return true;\n }\n\n /**\n * Removes a specific Assessment from the list of Assessments.\n *\n * @param {string} name The Assessment to remove from the list of assessments.\n * @returns {void}\n */\n removeAssessment(name) {\n const toDelete = findIndex(this._assessments, function(assessment) {\n return assessment.hasOwnProperty('identifier') && name === assessment.identifier;\n });\n\n if (-1 !== toDelete) {\n this._assessments.splice(toDelete, 1);\n }\n }\n\n /**\n * Returns an assessment by identifier\n *\n * @param {string} identifier The identifier of the assessment.\n * @returns {undefined|Assessment} The object if found, otherwise undefined.\n */\n getAssessment(identifier) {\n return find(this._assessments, function(assessment) {\n return assessment.hasOwnProperty('identifier') && identifier === assessment.identifier;\n });\n }\n\n /**\n * Checks which of the available assessments are applicable and returns an array with applicable assessments.\n *\n * @returns {Assessment[]} The array with applicable assessments.\n */\n getApplicableAssessments() {\n const availableAssessments = this.getAvailableAssessments();\n return filter(\n availableAssessments,\n function(availableAssessment) {\n return this.isApplicable(availableAssessment, this.getPaper(), this._researcher);\n }.bind(this)\n );\n }\n}\n\nexport default Assessor;\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAGA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,gBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAAkD,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AARlD;;AAGA;;AAOA;AACA,MAAMG,WAAW,GAAG,CAAC;;AAErB;AACA;A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AAI,CAACpE,YAAY,CAACsE,MAAM,CAACF,QAAQ,EAAE,CAAC,CAAC;IACvC;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEH,aAAaA,CAACD,UAAU,EAAE;IACxB,OAAO,IAAAO,YAAI,EAAC,IAAI,CAACvE,YAAY,EAAE,UAASM,UAAU,EAAE;MAClD,OAAOA,UAAU,CAACO,cAAc,CAAC,YAAY,CAAC,IAAImD,UAAU,KAAK1D,UAAU,CAAC0D,UAAU;IACxF,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;AACA;AACA;EACEQ,wBAAwBA,CAAA,EAAG;IACzB,MAAMC,oBAAoB,GAAG,IAAI,CAACrE,uBAAuB,CAAC,CAAC;IAC3D,OAAO,IAAA4B,cAAM,EACXyC,oBAAoB,EACpB,UAASC,mBAAmB,EAAE;MAC5B,OAAO,IAAI,CAACrE,YAAY,CAACqE,mBAAmB,EAAE,IAAI,CAACvD,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAChB,WAAW,CAAC;IAClF,CAAC,CAAC8B,IAAI,CAAC,IAAI,CACb,CAAC;EACH;AACF;AAAC,IAAA0C,QAAA,GAAAC,OAAA,CAAApF,OAAA,GAEcE,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"assessor.js","names":["_lodash","require","_AssessmentResult","_interopRequireDefault","_build","_LanguageProcessor","_missingArgument","_errors","_polaris","_react","e","__esModule","default","ScoreRating","Assessor","constructor","researcher","config","type","setResearcher","_assessments","isUndefined","MissingArgument","_researcher","getAvailableAssessments","isApplicable","assessment","paper","ignoreAssessments","getIgnoredAssessments","includes","_config","id","hasOwnProperty","hasMarker","isFunction","marker","getMarks","getSpecificMarker","getPaper","_lastPaper","assess","i18n","setPaper","languageProcessor","LanguageProcessor","shortcodes","_attributes","setTree","build","assessments","results","filter","bind","map","executeAssessment","result","title","translate","content","good","improve","bad","skippedAssessments","getSkippedAssessments","assessmentResult","AssessmentResult","score","getScore","priority","setScore","setStatus","setTitle","setBody","createElement","Text","as","docUrl","href","target","rel","getResult","setIdentifier","assessmentError","showTrace","getValidResults","isValidResult","hasScore","hasText","calculateOverallScore","totalScore","reduce","total","Math","round","length","addAssessment","name","identifier","getAssessment","removeAssessment","push","toDelete","findIndex","splice","find","getApplicableAssessments","availableAssessments","availableAssessment","_default","exports"],"sources":["../../../src/scoring/assessors/assessor.js"],"sourcesContent":["// External dependencies.\nimport {filter, find, findIndex, isFunction, isUndefined, map} from 'lodash';\n\n// Internal dependencies.\nimport AssessmentResult from '../../values/AssessmentResult.js';\nimport {build} from '../../parse/build';\nimport LanguageProcessor from '../../parse/language/LanguageProcessor.js';\nimport MissingArgument from '../../errors/missingArgument.js';\nimport {showTrace} from '../../helpers/errors.js';\nimport {Text} from '@shopify/polaris';\nimport React from 'react';\n\n// The maximum score of individual assessment is 9. This is why we set the \"score rating\" here to 9.\nconst ScoreRating = 9;\n\n/**\n * The Assessor is a base class for all assessors.\n */\nclass Assessor {\n /**\n * Creates a new Assessor instance.\n * @param {Researcher}\tresearcher\tThe researcher to use.\n * @param {Object}\t\t[config]\tThe assessor config.\n */\n constructor(researcher, config) {\n this.type = 'assessor';\n this.setResearcher(researcher);\n this._assessments = [];\n }\n\n /**\n * Checks if the researcher is defined and sets it.\n *\n * @param {Researcher} researcher The researcher to use in the assessor.\n *\n * @throws {MissingArgument} Parameter needs to be a valid researcher object.\n * @returns {void}\n */\n setResearcher(researcher) {\n if (isUndefined(researcher)) {\n throw new MissingArgument('The assessor requires a researcher.');\n }\n this._researcher = researcher;\n }\n\n /**\n * Gets all available assessments.\n * @returns {Assessment[]} assessment\n */\n getAvailableAssessments() {\n return this._assessments;\n }\n\n /**\n * Checks whether the Assessment is applicable.\n *\n * @param {Assessment} assessment The Assessment object that needs to be checked.\n * @param {Paper} paper The Paper object to check against.\n * @param {Researcher} [researcher] The Researcher object containing additional information.\n * @returns {boolean} Whether or not the Assessment is applicable.\n */\n isApplicable(assessment, paper, researcher) {\n const ignoreAssessments = paper.getIgnoredAssessments();\n\n if (ignoreAssessments.includes(assessment._config.id)) {\n return false;\n }\n\n if (\n assessment.hasOwnProperty('isApplicable') ||\n typeof assessment.isApplicable === 'function'\n ) {\n return assessment.isApplicable(paper, researcher);\n }\n\n return true;\n }\n\n /**\n * Determines whether an assessment has a marker.\n *\n * @param {Assessment} assessment The assessment to check for.\n * @returns {boolean} Whether or not the assessment has a marker.\n */\n hasMarker(assessment) {\n return (\n isFunction(this._config.marker) &&\n (assessment.hasOwnProperty('getMarks') || typeof assessment.getMarks === 'function')\n );\n }\n\n /**\n * Returns the specific marker for this assessor.\n *\n * @returns {Function} The specific marker for this assessor.\n */\n getSpecificMarker() {\n return this._config.marker;\n }\n\n /**\n * Returns the paper that was most recently assessed.\n *\n * @returns {Paper} The paper that was most recently assessed.\n */\n getPaper() {\n return this._lastPaper;\n }\n\n /**\n * Runs the researches defined in the task list or the default researches.\n *\n * @param {Paper} paper The paper to run assessments on.\n * @param i18n\n * @returns {void}\n */\n assess(paper, i18n) {\n this._researcher.setPaper(paper);\n\n const languageProcessor = new LanguageProcessor(this._researcher);\n const shortcodes = paper._attributes && paper._attributes.shortcodes;\n paper.setTree(build(paper, languageProcessor, shortcodes));\n\n let assessments = this.getAvailableAssessments();\n this.results = [];\n\n assessments = filter(\n assessments,\n function(assessment) {\n return this.isApplicable(assessment, paper, this._researcher);\n }.bind(this)\n );\n\n this.results = map(assessments, assessment =>\n this.executeAssessment({\n paper,\n researcher: this._researcher,\n assessment,\n i18n\n })\n );\n this._lastPaper = paper;\n }\n\n /**\n * Executes an assessment and returns the AssessmentResult.\n *\n * @param {Paper} paper The paper to pass to the assessment.\n * @param {Researcher} researcher The researcher to pass to the assessment.\n * @param {Assessment} assessment The assessment to execute.\n * @param i18n\n * @returns {AssessmentResult} The result of the assessment.\n */\n executeAssessment({paper, researcher, assessment, i18n}) {\n let result;\n\n try {\n if (i18n) {\n assessment._config.title = i18n.translate(`Axyseo.${assessment._config.id}.title`);\n assessment._config.content = {\n good: i18n.translate(`Axyseo.${assessment._config.id}.good`),\n improve: i18n.translate(`Axyseo.${assessment._config.id}.improve`),\n bad: i18n.translate(`Axyseo.${assessment._config.id}.bad`)\n };\n }\n\n const skippedAssessments = paper.getSkippedAssessments();\n\n if (skippedAssessments.includes(assessment._config.id)) {\n const assessmentResult = new AssessmentResult({config: assessment._config});\n\n const score = assessment.getScore(assessment._config.priority, 'good');\n\n assessmentResult.setScore(score);\n assessmentResult.setStatus('good');\n assessmentResult.setTitle(assessment._config.title);\n assessmentResult.setBody(\n <Text as={'span'}>\n {assessment._config.content.good}{' '}\n {assessment._config.docUrl && (\n <a href={assessment._config.docUrl} target=\"_blank\" rel=\"noreferrer\">\n {i18n ? i18n.translate(`Axyseo.Button.learnMore`) : 'Learn more'}\n </a>\n )}\n </Text>\n );\n\n result = assessmentResult;\n } else {\n result = assessment.getResult({paper, researcher, i18n});\n }\n result.setIdentifier(assessment._config.id);\n } catch (assessmentError) {\n showTrace(assessmentError);\n\n result = new AssessmentResult();\n\n result.setScore(-1);\n }\n return result;\n }\n\n /**\n * Filters out all assessment results that have no score and no text.\n *\n * @returns {AssessmentResult[]} The array with all the valid assessments.\n */\n getValidResults() {\n return filter(\n this.results,\n function(result) {\n return this.isValidResult(result);\n }.bind(this)\n );\n }\n\n /**\n * Returns if an assessmentResult is valid.\n *\n * @param {AssessmentResult} assessmentResult The assessmentResult to validate.\n * @returns {boolean} whether or not the result is valid.\n */\n isValidResult(assessmentResult) {\n return assessmentResult.hasScore() && assessmentResult.hasText();\n }\n\n /**\n * Returns the overall score. Calculates the total score by adding all scores and dividing these\n * by the number of results times the ScoreRating.\n *\n * @returns {number} The overall score.\n */\n calculateOverallScore() {\n const results = this.getValidResults();\n\n const totalScore = results.reduce(\n (total, assessmentResult) => total + assessmentResult.getScore(),\n 0\n );\n\n return Math.round((totalScore / (results.length * ScoreRating)) * 100) || 0;\n }\n\n /**\n * Registers an assessment and adds it to the internal assessments object.\n *\n * @param {string} name The name of the assessment.\n * @param {Assessment} assessment The object containing function to run as an assessment and it's requirements.\n * @returns {boolean} Whether registering the assessment was successful.\n */\n addAssessment(name, assessment) {\n if (!assessment.hasOwnProperty('identifier')) {\n assessment.identifier = name;\n }\n // If the assessor already has the same assessment, remove it and replace it with the new assessment with the same identifier.\n if (this.getAssessment(assessment.identifier)) {\n this.removeAssessment(assessment.identifier);\n }\n\n this._assessments.push(assessment);\n return true;\n }\n\n /**\n * Removes a specific Assessment from the list of Assessments.\n *\n * @param {string} name The Assessment to remove from the list of assessments.\n * @returns {void}\n */\n removeAssessment(name) {\n const toDelete = findIndex(this._assessments, function(assessment) {\n return assessment.hasOwnProperty('identifier') && name === assessment.identifier;\n });\n\n if (-1 !== toDelete) {\n this._assessments.splice(toDelete, 1);\n }\n }\n\n /**\n * Returns an assessment by identifier\n *\n * @param {string} identifier The identifier of the assessment.\n * @returns {undefined|Assessment} The object if found, otherwise undefined.\n */\n getAssessment(identifier) {\n return find(this._assessments, function(assessment) {\n return assessment.hasOwnProperty('identifier') && identifier === assessment.identifier;\n });\n }\n\n /**\n * Checks which of the available assessments are applicable and returns an array with applicable assessments.\n *\n * @returns {Assessment[]} The array with applicable assessments.\n */\n getApplicableAssessments() {\n const availableAssessments = this.getAvailableAssessments();\n return filter(\n availableAssessments,\n function(availableAssessment) {\n return this.isApplicable(availableAssessment, this.getPaper(), this._researcher);\n }.bind(this)\n );\n }\n}\n\nexport default Assessor;\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAGA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,gBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAN,sBAAA,CAAAF,OAAA;AAA0B,SAAAE,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AY,CAACoF,MAAM,CAACF,QAAQ,EAAE,CAAC,CAAC;IACvC;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEH,aAAaA,CAACD,UAAU,EAAE;IACxB,OAAO,IAAAO,YAAI,EAAC,IAAI,CAACrF,YAAY,EAAE,UAASM,UAAU,EAAE;MAClD,OAAOA,UAAU,CAACO,cAAc,CAAC,YAAY,CAAC,IAAIiE,UAAU,KAAKxE,UAAU,CAACwE,UAAU;IACxF,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;AACA;AACA;EACEQ,wBAAwBA,CAAA,EAAG;IACzB,MAAMC,oBAAoB,GAAG,IAAI,CAACnF,uBAAuB,CAAC,CAAC;IAC3D,OAAO,IAAA4B,cAAM,EACXuD,oBAAoB,EACpB,UAASC,mBAAmB,EAAE;MAC5B,OAAO,IAAI,CAACnF,YAAY,CAACmF,mBAAmB,EAAE,IAAI,CAACrE,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAChB,WAAW,CAAC;IAClF,CAAC,CAAC8B,IAAI,CAAC,IAAI,CACb,CAAC;EACH;AACF;AAAC,IAAAwD,QAAA,GAAAC,OAAA,CAAAlG,OAAA,GAEcE,QAAQ","ignoreList":[]}
|
|
@@ -24,6 +24,7 @@ var _UrlLengthAssessment = _interopRequireDefault(require("../assessments/seo/Ur
|
|
|
24
24
|
var _NumberInMetaTitleAssessment = _interopRequireDefault(require("../assessments/seo/NumberInMetaTitleAssessment"));
|
|
25
25
|
var _TextImagesAssessment = _interopRequireDefault(require("../assessments/seo/TextImagesAssessment"));
|
|
26
26
|
var _MetaTitleKeywordAssessment = _interopRequireDefault(require("../assessments/seo/MetaTitleKeywordAssessment"));
|
|
27
|
+
var _SchemaAssessment = _interopRequireDefault(require("../assessments/seo/SchemaAssessment"));
|
|
27
28
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
28
29
|
/**
|
|
29
30
|
* The SEOAssessor class is used for the general SEO analysis.
|
|
@@ -37,7 +38,7 @@ class SEOAssessor extends _assessor.default {
|
|
|
37
38
|
constructor(researcher, config) {
|
|
38
39
|
super(researcher, config);
|
|
39
40
|
this.type = 'SEOAssessor';
|
|
40
|
-
this._assessments = [new _MetaTitleKeywordAssessment.default(), new _TextImagesAssessment.default(), new _NumberInMetaTitleAssessment.default(), new _IntroductionKeywordAssessment.default(), new _KeyphraseLengthAssessment.default(), new _MetaDescriptionKeywordAssessment.default(), new _MetaDescriptionLengthAssessment.default(), new _SubHeadingsKeywordAssessment.default(), new _OutboundLinksAssessment.default(), new _KeywordDensityAssessment.default(), new _ImageCountAssessment.default(), new _UrlLengthAssessment.default(), new _TextLengthAssessment.default(), new _SingleTitleAssessment.default(), new _KeyphraseAssessment.default(), new _InternalLinksAssessment.default(), new _PageTitleWidthAssessment.default(), new _UrlKeywordAssessment.default(), new _SingleH1Assessment.default()];
|
|
41
|
+
this._assessments = [new _MetaTitleKeywordAssessment.default(), new _TextImagesAssessment.default(), new _NumberInMetaTitleAssessment.default(), new _IntroductionKeywordAssessment.default(), new _KeyphraseLengthAssessment.default(), new _MetaDescriptionKeywordAssessment.default(), new _MetaDescriptionLengthAssessment.default(), new _SubHeadingsKeywordAssessment.default(), new _OutboundLinksAssessment.default(), new _KeywordDensityAssessment.default(), new _ImageCountAssessment.default(), new _UrlLengthAssessment.default(), new _TextLengthAssessment.default(), new _SingleTitleAssessment.default(), new _KeyphraseAssessment.default(), new _InternalLinksAssessment.default(), new _PageTitleWidthAssessment.default(), new _UrlKeywordAssessment.default(), new _SingleH1Assessment.default(), new _SchemaAssessment.default()];
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
exports.default = SEOAssessor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seoAssessor.js","names":["_assessor","_interopRequireDefault","require","_IntroductionKeywordAssessment","_KeyphraseLengthAssessment","_MetaDescriptionKeywordAssessment","_MetaDescriptionLengthAssessment","_SubHeadingsKeywordAssessment","_OutboundLinksAssessment","_KeywordDensityAssessment","_InternalLinksAssessment","_UrlKeywordAssessment","_ImageCountAssessment","_TextLengthAssessment","_PageTitleWidthAssessment","_SingleH1Assessment","_KeyphraseAssessment","_SingleTitleAssessment","_UrlLengthAssessment","_NumberInMetaTitleAssessment","_TextImagesAssessment","_MetaTitleKeywordAssessment","e","__esModule","default","SEOAssessor","Assessor","constructor","researcher","config","type","_assessments","MetaTitleKeywordAssessment","TextImagesAssessment","NumberInMetaTitleAssessment","IntroductionKeywordAssessment","KeyphraseLengthAssessment","MetaDescriptionKeywordAssessment","MetaDescriptionLength","SubheadingsKeyword","OutboundLinks","KeyphraseDensityAssessment","ImageCount","UrlLengthAssessment","TextLength","SingleTitleAssessment","KeyphraseAssessment","InternalLinksAssessment","TitleWidth","SlugKeywordAssessment","SingleH1Assessment","exports"],"sources":["../../../src/scoring/assessors/seoAssessor.js"],"sourcesContent":["import Assessor from './assessor';\nimport IntroductionKeywordAssessment from '../assessments/seo/IntroductionKeywordAssessment';\nimport KeyphraseLengthAssessment from '../assessments/seo/KeyphraseLengthAssessment';\nimport MetaDescriptionKeywordAssessment from '../assessments/seo/MetaDescriptionKeywordAssessment';\nimport MetaDescriptionLength from '../assessments/seo/MetaDescriptionLengthAssessment';\nimport SubheadingsKeyword from '../assessments/seo/SubHeadingsKeywordAssessment';\nimport OutboundLinks from '../assessments/seo/OutboundLinksAssessment';\nimport KeyphraseDensityAssessment from '../assessments/seo/KeywordDensityAssessment';\nimport InternalLinksAssessment from '../assessments/seo/InternalLinksAssessment';\nimport SlugKeywordAssessment from '../assessments/seo/UrlKeywordAssessment';\nimport ImageCount from '../assessments/seo/ImageCountAssessment';\nimport TextLength from '../assessments/seo/TextLengthAssessment';\nimport TitleWidth from '../assessments/seo/PageTitleWidthAssessment';\nimport SingleH1Assessment from '../assessments/seo/SingleH1Assessment';\nimport KeyphraseAssessment from '../assessments/seo/KeyphraseAssessment';\nimport SingleTitleAssessment from '../assessments/seo/SingleTitleAssessment';\nimport UrlLengthAssessment from '../assessments/seo/UrlLengthAssessment';\nimport NumberInMetaTitleAssessment from '../assessments/seo/NumberInMetaTitleAssessment';\nimport TextImagesAssessment from '../assessments/seo/TextImagesAssessment';\nimport MetaTitleKeywordAssessment from '../assessments/seo/MetaTitleKeywordAssessment';\n\n/**\n * The SEOAssessor class is used for the general SEO analysis.\n */\nexport default class SEOAssessor extends Assessor {\n /**\n * Creates a new SEOAssessor 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 = 'SEOAssessor';\n\n this._assessments = [\n new MetaTitleKeywordAssessment(),\n new TextImagesAssessment(),\n new NumberInMetaTitleAssessment(),\n new IntroductionKeywordAssessment(),\n new KeyphraseLengthAssessment(),\n new MetaDescriptionKeywordAssessment(),\n new MetaDescriptionLength(),\n new SubheadingsKeyword(),\n new OutboundLinks(),\n new KeyphraseDensityAssessment(),\n new ImageCount(),\n new UrlLengthAssessment(),\n new TextLength(),\n new SingleTitleAssessment(),\n new KeyphraseAssessment(),\n new InternalLinksAssessment(),\n new TitleWidth(),\n new SlugKeywordAssessment(),\n new SingleH1Assessment()\n ];\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iCAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,gCAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,6BAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,wBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,yBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,wBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,qBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,qBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,qBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,yBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,mBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,oBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,sBAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,oBAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,4BAAA,GAAAlB,sBAAA,CAAAC,OAAA;AACA,IAAAkB,qBAAA,GAAAnB,sBAAA,CAAAC,OAAA;AACA,IAAAmB,2BAAA,GAAApB,sBAAA,CAAAC,OAAA;
|
|
1
|
+
{"version":3,"file":"seoAssessor.js","names":["_assessor","_interopRequireDefault","require","_IntroductionKeywordAssessment","_KeyphraseLengthAssessment","_MetaDescriptionKeywordAssessment","_MetaDescriptionLengthAssessment","_SubHeadingsKeywordAssessment","_OutboundLinksAssessment","_KeywordDensityAssessment","_InternalLinksAssessment","_UrlKeywordAssessment","_ImageCountAssessment","_TextLengthAssessment","_PageTitleWidthAssessment","_SingleH1Assessment","_KeyphraseAssessment","_SingleTitleAssessment","_UrlLengthAssessment","_NumberInMetaTitleAssessment","_TextImagesAssessment","_MetaTitleKeywordAssessment","_SchemaAssessment","e","__esModule","default","SEOAssessor","Assessor","constructor","researcher","config","type","_assessments","MetaTitleKeywordAssessment","TextImagesAssessment","NumberInMetaTitleAssessment","IntroductionKeywordAssessment","KeyphraseLengthAssessment","MetaDescriptionKeywordAssessment","MetaDescriptionLength","SubheadingsKeyword","OutboundLinks","KeyphraseDensityAssessment","ImageCount","UrlLengthAssessment","TextLength","SingleTitleAssessment","KeyphraseAssessment","InternalLinksAssessment","TitleWidth","SlugKeywordAssessment","SingleH1Assessment","SchemaAssessment","exports"],"sources":["../../../src/scoring/assessors/seoAssessor.js"],"sourcesContent":["import Assessor from './assessor';\nimport IntroductionKeywordAssessment from '../assessments/seo/IntroductionKeywordAssessment';\nimport KeyphraseLengthAssessment from '../assessments/seo/KeyphraseLengthAssessment';\nimport MetaDescriptionKeywordAssessment from '../assessments/seo/MetaDescriptionKeywordAssessment';\nimport MetaDescriptionLength from '../assessments/seo/MetaDescriptionLengthAssessment';\nimport SubheadingsKeyword from '../assessments/seo/SubHeadingsKeywordAssessment';\nimport OutboundLinks from '../assessments/seo/OutboundLinksAssessment';\nimport KeyphraseDensityAssessment from '../assessments/seo/KeywordDensityAssessment';\nimport InternalLinksAssessment from '../assessments/seo/InternalLinksAssessment';\nimport SlugKeywordAssessment from '../assessments/seo/UrlKeywordAssessment';\nimport ImageCount from '../assessments/seo/ImageCountAssessment';\nimport TextLength from '../assessments/seo/TextLengthAssessment';\nimport TitleWidth from '../assessments/seo/PageTitleWidthAssessment';\nimport SingleH1Assessment from '../assessments/seo/SingleH1Assessment';\nimport KeyphraseAssessment from '../assessments/seo/KeyphraseAssessment';\nimport SingleTitleAssessment from '../assessments/seo/SingleTitleAssessment';\nimport UrlLengthAssessment from '../assessments/seo/UrlLengthAssessment';\nimport NumberInMetaTitleAssessment from '../assessments/seo/NumberInMetaTitleAssessment';\nimport TextImagesAssessment from '../assessments/seo/TextImagesAssessment';\nimport MetaTitleKeywordAssessment from '../assessments/seo/MetaTitleKeywordAssessment';\nimport SchemaAssessment from '@axyseo/scoring/assessments/seo/SchemaAssessment';\n\n/**\n * The SEOAssessor class is used for the general SEO analysis.\n */\nexport default class SEOAssessor extends Assessor {\n /**\n * Creates a new SEOAssessor 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 = 'SEOAssessor';\n\n this._assessments = [\n new MetaTitleKeywordAssessment(),\n new TextImagesAssessment(),\n new NumberInMetaTitleAssessment(),\n new IntroductionKeywordAssessment(),\n new KeyphraseLengthAssessment(),\n new MetaDescriptionKeywordAssessment(),\n new MetaDescriptionLength(),\n new SubheadingsKeyword(),\n new OutboundLinks(),\n new KeyphraseDensityAssessment(),\n new ImageCount(),\n new UrlLengthAssessment(),\n new TextLength(),\n new SingleTitleAssessment(),\n new KeyphraseAssessment(),\n new InternalLinksAssessment(),\n new TitleWidth(),\n new SlugKeywordAssessment(),\n new SingleH1Assessment(),\n new SchemaAssessment()\n ];\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iCAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,gCAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,6BAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,wBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,yBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,wBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,qBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,qBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,qBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,yBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,mBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,oBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,sBAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,oBAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,4BAAA,GAAAlB,sBAAA,CAAAC,OAAA;AACA,IAAAkB,qBAAA,GAAAnB,sBAAA,CAAAC,OAAA;AACA,IAAAmB,2BAAA,GAAApB,sBAAA,CAAAC,OAAA;AACA,IAAAoB,iBAAA,GAAArB,sBAAA,CAAAC,OAAA;AAAgF,SAAAD,uBAAAsB,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhF;AACA;AACA;AACe,MAAMG,WAAW,SAASC,iBAAQ,CAAC;EAChD;AACF;AACA;AACA;AACA;EACEC,WAAWA,CAACC,UAAU,EAAEC,MAAM,EAAE;IAC9B,KAAK,CAACD,UAAU,EAAEC,MAAM,CAAC;IACzB,IAAI,CAACC,IAAI,GAAG,aAAa;IAEzB,IAAI,CAACC,YAAY,GAAG,CAClB,IAAIC,mCAA0B,CAAC,CAAC,EAChC,IAAIC,6BAAoB,CAAC,CAAC,EAC1B,IAAIC,oCAA2B,CAAC,CAAC,EACjC,IAAIC,sCAA6B,CAAC,CAAC,EACnC,IAAIC,kCAAyB,CAAC,CAAC,EAC/B,IAAIC,yCAAgC,CAAC,CAAC,EACtC,IAAIC,wCAAqB,CAAC,CAAC,EAC3B,IAAIC,qCAAkB,CAAC,CAAC,EACxB,IAAIC,gCAAa,CAAC,CAAC,EACnB,IAAIC,iCAA0B,CAAC,CAAC,EAChC,IAAIC,6BAAU,CAAC,CAAC,EAChB,IAAIC,4BAAmB,CAAC,CAAC,EACzB,IAAIC,6BAAU,CAAC,CAAC,EAChB,IAAIC,8BAAqB,CAAC,CAAC,EAC3B,IAAIC,4BAAmB,CAAC,CAAC,EACzB,IAAIC,gCAAuB,CAAC,CAAC,EAC7B,IAAIC,iCAAU,CAAC,CAAC,EAChB,IAAIC,6BAAqB,CAAC,CAAC,EAC3B,IAAIC,2BAAkB,CAAC,CAAC,EACxB,IAAIC,yBAAgB,CAAC,CAAC,CACvB;EACH;AACF;AAACC,OAAA,CAAA5B,OAAA,GAAAC,WAAA","ignoreList":[]}
|
package/build/values/Paper.js
CHANGED
|
@@ -54,6 +54,7 @@ class Paper {
|
|
|
54
54
|
* @param {string} [attributes.date] The date.
|
|
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
|
+
* @param {Object[]} [attributes.skippedAssessments] The array of texts, show which assessments should be skipped (those assessments will have good result).
|
|
57
58
|
* @param {Object} [attributes.customData] Custom data.
|
|
58
59
|
* @param {Object} [attributes.shopSettings] Shop's settings.
|
|
59
60
|
* @param {string} [attributes.textTitle] The title of the text.
|
|
@@ -282,6 +283,14 @@ class Paper {
|
|
|
282
283
|
return this._attributes?.ignoredAssessments || [];
|
|
283
284
|
}
|
|
284
285
|
|
|
286
|
+
/**
|
|
287
|
+
*
|
|
288
|
+
* @returns {Object[String]|*[String]}
|
|
289
|
+
*/
|
|
290
|
+
getSkippedAssessments() {
|
|
291
|
+
return this._attributes?.skippedAssessments || [];
|
|
292
|
+
}
|
|
293
|
+
|
|
285
294
|
/**
|
|
286
295
|
*
|
|
287
296
|
* @returns {*|{}}
|
|
@@ -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","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.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 {*|{}}\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,OA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,CAACC,UAAU,EAAE;IACvB;IACA,IAAIA,UAAU,YAAYjE,KAAK,EAAE;MAC/B,OAAOiE,UAAU;IACnB;;IAEA;IACA;IACA,MAAM;MAAC/D,IAAI;MAAE0D,WAAW;MAAE,GAAGzD;IAAU,CAAC,GAAG8D,UAAU;IAErD,OAAO,IAAIjE,KAAK,CAACE,IAAI,EAAEC,UAAU,CAAC;EACpC;AACF;AAAC+D,OAAA,CAAAC,OAAA,GAAAnE,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","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;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,EA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