axyseo 2.1.52 → 2.1.54

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.
@@ -35,7 +35,10 @@ const transformRelatedKeyword = keywords => keywords.map(keyword => typeof keywo
35
35
  */
36
36
  exports.transformRelatedKeyword = transformRelatedKeyword;
37
37
  const getTextFullPage = data => {
38
- const faqString = data.faqs.status ? data.faqs.questions.map(i => i.question + ' ' + i.answer).join(' ') : '';
38
+ // const faqString = data.faqs.status
39
+ // ? data.faqs.questions.map(i => i.question + ' ' + i.answer).join(' ')
40
+ // : '';
41
+ const faqString = '';
39
42
  const html = data.body_html || data.descriptionHtml;
40
43
  const bodyString = html?.length > 0 ? html.replace(/<\/?[^>]+(>|$)/g, ' ').replace(/\s+/g, ' ').trim() : '';
41
44
  return [faqString, data.title, bodyString, data?.metafields_avadaSEO_after_content, data.metafields_global_title_tag, data.metafields_global_description_tag].join(' ').toLowerCase();
@@ -1 +1 @@
1
- {"version":3,"file":"checkRelatedKeywords.js","names":["_default","paper","researcher","data","getData","related_keywords","transformRelatedKeyword","string","getTextFullPage","countWordsInRelatedKeywords","keywords","map","keyword","text","exports","faqString","faqs","status","questions","i","question","answer","join","html","body_html","descriptionHtml","bodyString","length","replace","trim","title","metafields_avadaSEO_after_content","metafields_global_title_tag","metafields_global_description_tag","toLowerCase","escapeRegExp","total","split","filter","word","words","totalWordUsed","isWordUsedExceeding","forEach","toLocaleLowerCase","escapedKeyword","regex","RegExp","match","percentage","parseFloat","toFixed"],"sources":["../../../../src/languageProcessing/researches/checkRelatedKeywords.js"],"sourcesContent":["/**\n * Checks how many sentences from a text contain at least one transition word or two-part transition word\n * that are defined in the transition words config and two part transition words config.\n *\n * @param {Paper} paper The Paper object to get text from.\n * @param {Researcher} researcher The researcher.\n *\n * @returns {object} An object with the total number of sentences in the text\n * and the total number of sentences containing one or more transition words.\n */\nexport default function(paper, researcher) {\n const data = paper.getData();\n const related_keywords = transformRelatedKeyword(data?.related_keywords || []);\n const string = getTextFullPage(data);\n return countWordsInRelatedKeywords({related_keywords, string});\n}\n\nexport const transformRelatedKeyword = keywords =>\n keywords.map(keyword => (typeof keyword === 'string' ? {text: keyword} : keyword)) || [];\n\n/**\n *\n * @param data\n * @returns {string}\n */\nconst getTextFullPage = data => {\n const faqString = data.faqs.status\n ? data.faqs.questions.map(i => i.question + ' ' + i.answer).join(' ')\n : '';\n const html = data.body_html || data.descriptionHtml;\n const bodyString =\n html?.length > 0\n ? html\n .replace(/<\\/?[^>]+(>|$)/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim()\n : '';\n return [\n faqString,\n data.title,\n bodyString,\n data?.metafields_avadaSEO_after_content,\n data.metafields_global_title_tag,\n data.metafields_global_description_tag\n ]\n .join(' ')\n .toLowerCase();\n};\n\nconst escapeRegExp = string => {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n};\n\n/**\n *\n * @param related_keywords\n * @param string\n * @returns {{totalWordUsed: number, words: {}, isWordUsedExceeding: boolean}}\n */\nconst countWordsInRelatedKeywords = ({related_keywords, string}) => {\n const total = string.split(/\\s+/).filter(word => word.length > 0).length;\n const words = {};\n let totalWordUsed = 0;\n let isWordUsedExceeding = false;\n\n related_keywords.forEach(({text}) => {\n const keyword = text.toLocaleLowerCase();\n const escapedKeyword = escapeRegExp(keyword);\n const regex = new RegExp(`(?:^|\\\\W)${escapedKeyword}(?:\\\\W|$)`, 'gu');\n const length = (string.match(regex) || []).length;\n\n const percentage = parseFloat(((length / total) * 100).toFixed(1));\n if (!isWordUsedExceeding) {\n isWordUsedExceeding = percentage > 1;\n }\n totalWordUsed += length;\n words[text] = {length, percentage};\n });\n\n return {totalWordUsed, words, isWordUsedExceeding};\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAAA,SAASC,KAAK,EAAEC,UAAU,EAAE;EACzC,MAAMC,IAAI,GAAGF,KAAK,CAACG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ignoreList":[]}
1
+ {"version":3,"file":"checkRelatedKeywords.js","names":["_default","paper","researcher","data","getData","related_keywords","transformRelatedKeyword","string","getTextFullPage","countWordsInRelatedKeywords","keywords","map","keyword","text","exports","faqString","html","body_html","descriptionHtml","bodyString","length","replace","trim","title","metafields_avadaSEO_after_content","metafields_global_title_tag","metafields_global_description_tag","join","toLowerCase","escapeRegExp","total","split","filter","word","words","totalWordUsed","isWordUsedExceeding","forEach","toLocaleLowerCase","escapedKeyword","regex","RegExp","match","percentage","parseFloat","toFixed"],"sources":["../../../../src/languageProcessing/researches/checkRelatedKeywords.js"],"sourcesContent":["/**\n * Checks how many sentences from a text contain at least one transition word or two-part transition word\n * that are defined in the transition words config and two part transition words config.\n *\n * @param {Paper} paper The Paper object to get text from.\n * @param {Researcher} researcher The researcher.\n *\n * @returns {object} An object with the total number of sentences in the text\n * and the total number of sentences containing one or more transition words.\n */\nexport default function(paper, researcher) {\n const data = paper.getData();\n const related_keywords = transformRelatedKeyword(data?.related_keywords || []);\n const string = getTextFullPage(data);\n return countWordsInRelatedKeywords({related_keywords, string});\n}\n\nexport const transformRelatedKeyword = keywords =>\n keywords.map(keyword => (typeof keyword === 'string' ? {text: keyword} : keyword)) || [];\n\n/**\n *\n * @param data\n * @returns {string}\n */\nconst getTextFullPage = data => {\n // const faqString = data.faqs.status\n // ? data.faqs.questions.map(i => i.question + ' ' + i.answer).join(' ')\n // : '';\n const faqString = '';\n const html = data.body_html || data.descriptionHtml;\n const bodyString =\n html?.length > 0\n ? html\n .replace(/<\\/?[^>]+(>|$)/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim()\n : '';\n return [\n faqString,\n data.title,\n bodyString,\n data?.metafields_avadaSEO_after_content,\n data.metafields_global_title_tag,\n data.metafields_global_description_tag\n ]\n .join(' ')\n .toLowerCase();\n};\n\nconst escapeRegExp = string => {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n};\n\n/**\n *\n * @param related_keywords\n * @param string\n * @returns {{totalWordUsed: number, words: {}, isWordUsedExceeding: boolean}}\n */\nconst countWordsInRelatedKeywords = ({related_keywords, string}) => {\n const total = string.split(/\\s+/).filter(word => word.length > 0).length;\n const words = {};\n let totalWordUsed = 0;\n let isWordUsedExceeding = false;\n\n related_keywords.forEach(({text}) => {\n const keyword = text.toLocaleLowerCase();\n const escapedKeyword = escapeRegExp(keyword);\n const regex = new RegExp(`(?:^|\\\\W)${escapedKeyword}(?:\\\\W|$)`, 'gu');\n const length = (string.match(regex) || []).length;\n\n const percentage = parseFloat(((length / total) * 100).toFixed(1));\n if (!isWordUsedExceeding) {\n isWordUsedExceeding = percentage > 1;\n }\n totalWordUsed += length;\n words[text] = {length, percentage};\n });\n\n return {totalWordUsed, words, isWordUsedExceeding};\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAAA,SAASC,KAAK,EAAEC,UAAU,EAAE;EACzC,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAAC,CAAC;EAC5B,MAAMC,gBAAgB,GAAGC,uBAAuB,CAACH,IAAI,EAAEE,gBAAgB,IAAI,EAAE,CAAC;EAC9E,MAAME,MAAM,GAAGC,eAAe,CAACL,IAAI,CAAC;EACpC,OAAOM,2BAA2B,CAAC;IAACJ,gBAAgB;IAAEE;EAAM,CAAC,CAAC;AAChE;AAEO,MAAMD,uBAAuB,GAAGI,QAAQ,IAC7CA,QAAQ,CAACC,GAAG,CAACC,OAAO,IAAK,OAAOA,OAAO,KAAK,QAAQ,GAAG;EAACC,IAAI,EAAED;AAAO,CAAC,GAAGA,OAAQ,CAAC,IAAI,EAAE;;AAE1F;AACA;AACA;AACA;AACA;AAJAE,OAAA,CAAAR,uBAAA,GAAAA,uBAAA;AAKA,MAAME,eAAe,GAAGL,IAAI,IAAI;EAC9B;EACA;EACA;EACA,MAAMY,SAAS,GAAG,EAAE;EACpB,MAAMC,IAAI,GAAGb,IAAI,CAACc,SAAS,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ACF,KAAK,CAAC,IAAI,EAAE,EAAEpB,MAAM;IAEjD,MAAMuB,UAAU,GAAGC,UAAU,CAAC,CAAExB,MAAM,GAAGU,KAAK,GAAI,GAAG,EAAEe,OAAO,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,CAACT,mBAAmB,EAAE;MACxBA,mBAAmB,GAAGO,UAAU,GAAG,CAAC;IACtC;IACAR,aAAa,IAAIf,MAAM;IACvBc,KAAK,CAACrB,IAAI,CAAC,GAAG;MAACO,MAAM;MAAEuB;IAAU,CAAC;EACpC,CAAC,CAAC;EAEF,OAAO;IAACR,aAAa;IAAED,KAAK;IAAEE;EAAmB,CAAC;AACpD,CAAC","ignoreList":[]}
@@ -52,6 +52,7 @@ class RelatedKeywordsDensityAssessment extends _assessment.default {
52
52
  } = relatedKeywords;
53
53
  let status = 'good';
54
54
  const totalWords = Object.values(words).filter(word => word.percentage === 0);
55
+ console.log("Related keyword density check: ", !hasDescription, (0, _lodash.isEmpty)(words), totalWords.length > 0);
55
56
  if (!hasDescription || (0, _lodash.isEmpty)(words) || totalWords.length > 0) {
56
57
  status = 'bad';
57
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RelatedKeywordsDensityAssessment.js","names":["_lodash","require","_AssessmentResult","_interopRequireDefault","_assessment","_analysis","e","__esModule","default","RelatedKeywordsDensityAssessment","Assessment","constructor","config","defaultConfig","id","RELATED_KEYWORDS_DENSITY_ID","fixPosition","ctaType","docUrl","priority","title","content","good","bad","improve","identifier","_config","merge","calculateResult","data","relatedKeywords","hasDescription","words","status","totalWords","Object","values","filter","word","percentage","isEmpty","length","score","getScore","MAIN_CONTENT_POINTS","getResult","paper","researcher","getResearch","getData","result","assessmentResult","AssessmentResult","setScore","setStatus","setData","isApplicable","exports"],"sources":["../../../../../src/scoring/assessments/seo/RelatedKeywordsDensityAssessment.js"],"sourcesContent":["import {isEmpty, merge} from 'lodash';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport Assessment from '../assessment';\nimport {MAIN_CONTENT_POINTS, RELATED_KEYWORDS_DENSITY_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents the assessment that checks whether there are enough transition words in the text.\n */\nexport default class RelatedKeywordsDensityAssessment 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: RELATED_KEYWORDS_DENSITY_ID,\n fixPosition: 'description',\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#related-keywords',\n priority: 'high',\n title: 'Related keywords density',\n content: {\n good: 'Related keywords density optimized',\n bad:\n 'Use each secondary keyword from 0.5% to 1%. Place where it reads naturally.',\n improve: ''\n }\n };\n\n this.identifier = RELATED_KEYWORDS_DENSITY_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n *\n * @param data\n * @param relatedKeywords\n * @param hasDescription\n * @returns {{score: number, status: string, words}}\n */\n calculateResult(data, relatedKeywords, hasDescription) {\n const {words} = relatedKeywords;\n let status = 'good';\n const totalWords = Object.values(words).filter(word => word.percentage === 0);\n if(!hasDescription || isEmpty(words) || totalWords.length > 0){\n status = 'bad';\n }\n const score = this.getScore(MAIN_CONTENT_POINTS, status);\n\n return {\n score,\n status,\n words\n };\n }\n\n /**\n *\n * @param paper\n * @param researcher\n * @returns {AssessmentResult}\n */\n getResult({paper, researcher}) {\n const relatedKeywords = researcher.getResearch('checkRelatedKeywords');\n const data = paper.getData();\n const hasDescription = paper.hasDescription();\n const result = this.calculateResult(data, relatedKeywords, hasDescription);\n const assessmentResult = new AssessmentResult({config: this._config});\n\n assessmentResult.setScore(result.score);\n assessmentResult.setStatus(result.status);\n assessmentResult.setData(result.words);\n\n return assessmentResult;\n }\n\n /**\n * Checks if the transition words assessment is applicable to the paper. Language-specific length requirements and methods of counting text length\n * may apply (e.g. for Japanese, the text should be counted in characters instead of words, which also makes the minimum required length higher).\n *\n * @param {Paper} paper The paper to check.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} Returns true if the language is available, the paper is not empty and the text is longer than the minimum required length.\n */\n isApplicable(paper, researcher) {\n return true;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAAwF,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAExF;AACA;AACA;AACe,MAAMG,gCAAgC,SAASC,mBAAU,CAAC;EACvE;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEC,qCAA2B;MAC/BC,WAAW,EAAE,aAAa;MAC1BC,OAAO,EAAE,KAAK;MACdC,MAAM,EACJ,8FAA8F;MAChGC,QAAQ,EAAE,MAAM;MAChBC,KAAK,EAAE,0BAA0B;MACjCC,OAAO,EAAE;QACPC,IAAI,EAAE,oCAAoC;QAC1CC,GAAG,EACD,6EAA6E;QAC/EC,OAAO,EAAE;MACX;IACF,CAAC;IAED,IAAI,CAACC,UAAU,GAAGV,qCAA2B;IAC7C,IAAI,CAACW,OAAO,GAAG,IAAAC,aAAK,EAACd,aAAa,EAAED,MAAM,CAAC;EAC7C;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEgB,eAAeA,CAACC,IAAI,EAAEC,eAAe,EAAEC,cAAc,EAAE;IACrD,MAAM;MAACC;IAAK,CAAC,GAAGF,eAAe;IAC/B,IAAIG,MAAM,GAAG,MAAM;IACnB,MAAMC,UAAU,GAAGC,MAAM,CAACC,MAAM,CAACJ,KAAK,CAAC,CAACK,MAAM,CAACC,IAAI,IAAIA,IAAI,CAACC,UAAU,KAAK,CAAC,CAAC;IAC7E,IAAG,CAACR,cAAc,IAAI,IAAAS,eAAO,EAACR,KAAK,CAAC,IAAIE,UAAU,CAACO,MAAM,GAAG,CAAC,EAAC;MAC5DR,MAAM,GAAG,KAAK;IAChB;IACA,MAAMS,KAAK,GAAG,IAAI,CAACC,QAAQ,CAACC,6BAAmB,EAAEX,MAAM,CAAC;IAExD,OAAO;MACLS,KAAK;MACLT,MAAM;MACND;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEa,SAASA,CAAC;IAACC,KAAK;IAAEC;EAAU,CAAC,EAAE;IAC7B,MAAMjB,eAAe,GAAGiB,UAAU,CAACC,WAAW,CAAC,sBAAsB,CAAC;IACtE,MAAMnB,IAAI,GAAGiB,KAAK,CAACG,OAAO,CAAC,CAAC;IAC5B,MAAMlB,cAAc,GAAGe,KAAK,CAACf,cAAc,CAAC,CAAC;IAC7C,MAAMmB,MAAM,GAAG,IAAI,CAACtB,eAAe,CAACC,IAAI,EAAEC,eAAe,EAAEC,cAAc,CAAC;IAC1E,MAAMoB,gBAAgB,GAAG,IAAIC,yBAAgB,CAAC;MAACxC,MAAM,EAAE,IAAI,CAACc;IAAO,CAAC,CAAC;IAErEyB,gBAAgB,CAACE,QAAQ,CAACH,MAAM,CAACR,KAAK,CAAC;IACvCS,gBAAgB,CAACG,SAAS,CAACJ,MAAM,CAACjB,MAAM,CAAC;IACzCkB,gBAAgB,CAACI,OAAO,CAACL,MAAM,CAAClB,KAAK,CAAC;IAEtC,OAAOmB,gBAAgB;EACzB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEK,YAAYA,CAACV,KAAK,EAAEC,UAAU,EAAE;IAC9B,OAAO,IAAI;EACb;AACF;AAACU,OAAA,CAAAjD,OAAA,GAAAC,gCAAA","ignoreList":[]}
1
+ {"version":3,"file":"RelatedKeywordsDensityAssessment.js","names":["_lodash","require","_AssessmentResult","_interopRequireDefault","_assessment","_analysis","e","__esModule","default","RelatedKeywordsDensityAssessment","Assessment","constructor","config","defaultConfig","id","RELATED_KEYWORDS_DENSITY_ID","fixPosition","ctaType","docUrl","priority","title","content","good","bad","improve","identifier","_config","merge","calculateResult","data","relatedKeywords","hasDescription","words","status","totalWords","Object","values","filter","word","percentage","console","log","isEmpty","length","score","getScore","MAIN_CONTENT_POINTS","getResult","paper","researcher","getResearch","getData","result","assessmentResult","AssessmentResult","setScore","setStatus","setData","isApplicable","exports"],"sources":["../../../../../src/scoring/assessments/seo/RelatedKeywordsDensityAssessment.js"],"sourcesContent":["import {isEmpty, merge} from 'lodash';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport Assessment from '../assessment';\nimport {MAIN_CONTENT_POINTS, RELATED_KEYWORDS_DENSITY_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents the assessment that checks whether there are enough transition words in the text.\n */\nexport default class RelatedKeywordsDensityAssessment 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: RELATED_KEYWORDS_DENSITY_ID,\n fixPosition: 'description',\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#related-keywords',\n priority: 'high',\n title: 'Related keywords density',\n content: {\n good: 'Related keywords density optimized',\n bad:\n 'Use each secondary keyword from 0.5% to 1%. Place where it reads naturally.',\n improve: ''\n }\n };\n\n this.identifier = RELATED_KEYWORDS_DENSITY_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n *\n * @param data\n * @param relatedKeywords\n * @param hasDescription\n * @returns {{score: number, status: string, words}}\n */\n calculateResult(data, relatedKeywords, hasDescription) {\n const {words} = relatedKeywords;\n let status = 'good';\n const totalWords = Object.values(words).filter(word => word.percentage === 0);\n console.log(\"Related keyword density check: \", !hasDescription, isEmpty(words), totalWords.length > 0);\n if(!hasDescription || isEmpty(words) || totalWords.length > 0){\n status = 'bad';\n }\n const score = this.getScore(MAIN_CONTENT_POINTS, status);\n\n return {\n score,\n status,\n words\n };\n }\n\n /**\n *\n * @param paper\n * @param researcher\n * @returns {AssessmentResult}\n */\n getResult({paper, researcher}) {\n const relatedKeywords = researcher.getResearch('checkRelatedKeywords');\n const data = paper.getData();\n const hasDescription = paper.hasDescription();\n const result = this.calculateResult(data, relatedKeywords, hasDescription);\n const assessmentResult = new AssessmentResult({config: this._config});\n\n assessmentResult.setScore(result.score);\n assessmentResult.setStatus(result.status);\n assessmentResult.setData(result.words);\n\n return assessmentResult;\n }\n\n /**\n * Checks if the transition words assessment is applicable to the paper. Language-specific length requirements and methods of counting text length\n * may apply (e.g. for Japanese, the text should be counted in characters instead of words, which also makes the minimum required length higher).\n *\n * @param {Paper} paper The paper to check.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} Returns true if the language is available, the paper is not empty and the text is longer than the minimum required length.\n */\n isApplicable(paper, researcher) {\n return true;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAAwF,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAExF;AACA;AACA;AACe,MAAMG,gCAAgC,SAASC,mBAAU,CAAC;EACvE;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEC,qCAA2B;MAC/BC,WAAW,EAAE,aAAa;MAC1BC,OAAO,EAAE,KAAK;MACdC,MAAM,EACJ,8FAA8F;MAChGC,QA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KAAK,CAACjB,cAAc,CAAC,CAAC;IAC7C,MAAMqB,MAAM,GAAG,IAAI,CAACxB,eAAe,CAACC,IAAI,EAAEC,eAAe,EAAEC,cAAc,CAAC;IAC1E,MAAMsB,gBAAgB,GAAG,IAAIC,yBAAgB,CAAC;MAAC1C,MAAM,EAAE,IAAI,CAACc;IAAO,CAAC,CAAC;IAErE2B,gBAAgB,CAACE,QAAQ,CAACH,MAAM,CAACR,KAAK,CAAC;IACvCS,gBAAgB,CAACG,SAAS,CAACJ,MAAM,CAACnB,MAAM,CAAC;IACzCoB,gBAAgB,CAACI,OAAO,CAACL,MAAM,CAACpB,KAAK,CAAC;IAEtC,OAAOqB,gBAAgB;EACzB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEK,YAAYA,CAACV,KAAK,EAAEC,UAAU,EAAE;IAC9B,OAAO,IAAI;EACb;AACF;AAACU,OAAA,CAAAnD,OAAA,GAAAC,gCAAA","ignoreList":[]}
@@ -27,7 +27,10 @@ export const transformRelatedKeyword = keywords => keywords.map(keyword => typeo
27
27
  * @returns {string}
28
28
  */
29
29
  const getTextFullPage = data => {
30
- const faqString = data.faqs.status ? data.faqs.questions.map(i => i.question + ' ' + i.answer).join(' ') : '';
30
+ // const faqString = data.faqs.status
31
+ // ? data.faqs.questions.map(i => i.question + ' ' + i.answer).join(' ')
32
+ // : '';
33
+ const faqString = '';
31
34
  const html = data.body_html || data.descriptionHtml;
32
35
  const bodyString = html?.length > 0 ? html.replace(/<\/?[^>]+(>|$)/g, ' ').replace(/\s+/g, ' ').trim() : '';
33
36
  return [faqString, data.title, bodyString, data?.metafields_avadaSEO_after_content, data.metafields_global_title_tag, data.metafields_global_description_tag].join(' ').toLowerCase();
@@ -1 +1 @@
1
- {"version":3,"file":"checkRelatedKeywords.js","names":["paper","researcher","data","getData","related_keywords","transformRelatedKeyword","string","getTextFullPage","countWordsInRelatedKeywords","keywords","map","keyword","text","faqString","faqs","status","questions","i","question","answer","join","html","body_html","descriptionHtml","bodyString","length","replace","trim","title","metafields_avadaSEO_after_content","metafields_global_title_tag","metafields_global_description_tag","toLowerCase","escapeRegExp","total","split","filter","word","words","totalWordUsed","isWordUsedExceeding","forEach","toLocaleLowerCase","escapedKeyword","regex","RegExp","match","percentage","parseFloat","toFixed"],"sources":["../../../../src/languageProcessing/researches/checkRelatedKeywords.js"],"sourcesContent":["/**\n * Checks how many sentences from a text contain at least one transition word or two-part transition word\n * that are defined in the transition words config and two part transition words config.\n *\n * @param {Paper} paper The Paper object to get text from.\n * @param {Researcher} researcher The researcher.\n *\n * @returns {object} An object with the total number of sentences in the text\n * and the total number of sentences containing one or more transition words.\n */\nexport default function(paper, researcher) {\n const data = paper.getData();\n const related_keywords = transformRelatedKeyword(data?.related_keywords || []);\n const string = getTextFullPage(data);\n return countWordsInRelatedKeywords({related_keywords, string});\n}\n\nexport const transformRelatedKeyword = keywords =>\n keywords.map(keyword => (typeof keyword === 'string' ? {text: keyword} : keyword)) || [];\n\n/**\n *\n * @param data\n * @returns {string}\n */\nconst getTextFullPage = data => {\n const faqString = data.faqs.status\n ? data.faqs.questions.map(i => i.question + ' ' + i.answer).join(' ')\n : '';\n const html = data.body_html || data.descriptionHtml;\n const bodyString =\n html?.length > 0\n ? html\n .replace(/<\\/?[^>]+(>|$)/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim()\n : '';\n return [\n faqString,\n data.title,\n bodyString,\n data?.metafields_avadaSEO_after_content,\n data.metafields_global_title_tag,\n data.metafields_global_description_tag\n ]\n .join(' ')\n .toLowerCase();\n};\n\nconst escapeRegExp = string => {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n};\n\n/**\n *\n * @param related_keywords\n * @param string\n * @returns {{totalWordUsed: number, words: {}, isWordUsedExceeding: boolean}}\n */\nconst countWordsInRelatedKeywords = ({related_keywords, string}) => {\n const total = string.split(/\\s+/).filter(word => word.length > 0).length;\n const words = {};\n let totalWordUsed = 0;\n let isWordUsedExceeding = false;\n\n related_keywords.forEach(({text}) => {\n const keyword = text.toLocaleLowerCase();\n const escapedKeyword = escapeRegExp(keyword);\n const regex = new RegExp(`(?:^|\\\\W)${escapedKeyword}(?:\\\\W|$)`, 'gu');\n const length = (string.match(regex) || []).length;\n\n const percentage = parseFloat(((length / total) * 100).toFixed(1));\n if (!isWordUsedExceeding) {\n isWordUsedExceeding = percentage > 1;\n }\n totalWordUsed += length;\n words[text] = {length, percentage};\n });\n\n return {totalWordUsed, words, isWordUsedExceeding};\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAASA,KAAK,EAAEC,UAAU,EAAE;EACzC,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAAC,CAAC;EAC5B,MAAMC,gBAAgB,GAAGC,uBAAuB,CAACH,IAAI,EAAEE,gBAAgB,IAAI,EAAE,CAAC;EAC9E,MAAME,MAAM,GAAGC,eAAe,CAACL,IAAI,CAAC;EACpC,OAAOM,2BAA2B,CAAC;IAACJ,gBAAgB;IAAEE;EAAM,CAAC,CAAC;AAChE;AAEA,OAAO,MAAMD,uBAAuB,GAAGI,QAAQ,IAC7CA,QAAQ,CAACC,GAAG,CAACC,OAAO,IAAK,OAAOA,OAAO,KAAK,QAAQ,GAAG;EAACC,IAAI,EAAED;AAAO,CAAC,GAAGA,OAAQ,CAAC,IAAI,EAAE;;AAE1F;AACA;AACA;AACA;AACA;AACA,MAAMJ,eAAe,GAAGL,IAAI,IAAI;EAC9B,MAAMW,SAAS,GAAGX,IAAI,CAACY,IAAI,CAACC,MAAM,GAC9Bb,IAAI,CAACY,IAAI,CAACE,SAAS,CAACN,GAAG,CAACO,CAAC,IAAIA,CAAC,CAACC,QAAQ,GAAG,GAAG,GAAGD,CAAC,CAACE,MAAM,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,GACnE,EAAE;EACN,MAAMC,IAAI,GAAGnB,IAAI,CAACoB,SAAS,IAAIpB,IAAI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ACF,KAAK,CAAC,IAAI,EAAE,EAAEnB,MAAM;IAEjD,MAAMsB,UAAU,GAAGC,UAAU,CAAC,CAAEvB,MAAM,GAAGS,KAAK,GAAI,GAAG,EAAEe,OAAO,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,CAACT,mBAAmB,EAAE;MACxBA,mBAAmB,GAAGO,UAAU,GAAG,CAAC;IACtC;IACAR,aAAa,IAAId,MAAM;IACvBa,KAAK,CAAC1B,IAAI,CAAC,GAAG;MAACa,MAAM;MAAEsB;IAAU,CAAC;EACpC,CAAC,CAAC;EAEF,OAAO;IAACR,aAAa;IAAED,KAAK;IAAEE;EAAmB,CAAC;AACpD,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"checkRelatedKeywords.js","names":["paper","researcher","data","getData","related_keywords","transformRelatedKeyword","string","getTextFullPage","countWordsInRelatedKeywords","keywords","map","keyword","text","faqString","html","body_html","descriptionHtml","bodyString","length","replace","trim","title","metafields_avadaSEO_after_content","metafields_global_title_tag","metafields_global_description_tag","join","toLowerCase","escapeRegExp","total","split","filter","word","words","totalWordUsed","isWordUsedExceeding","forEach","toLocaleLowerCase","escapedKeyword","regex","RegExp","match","percentage","parseFloat","toFixed"],"sources":["../../../../src/languageProcessing/researches/checkRelatedKeywords.js"],"sourcesContent":["/**\n * Checks how many sentences from a text contain at least one transition word or two-part transition word\n * that are defined in the transition words config and two part transition words config.\n *\n * @param {Paper} paper The Paper object to get text from.\n * @param {Researcher} researcher The researcher.\n *\n * @returns {object} An object with the total number of sentences in the text\n * and the total number of sentences containing one or more transition words.\n */\nexport default function(paper, researcher) {\n const data = paper.getData();\n const related_keywords = transformRelatedKeyword(data?.related_keywords || []);\n const string = getTextFullPage(data);\n return countWordsInRelatedKeywords({related_keywords, string});\n}\n\nexport const transformRelatedKeyword = keywords =>\n keywords.map(keyword => (typeof keyword === 'string' ? {text: keyword} : keyword)) || [];\n\n/**\n *\n * @param data\n * @returns {string}\n */\nconst getTextFullPage = data => {\n // const faqString = data.faqs.status\n // ? data.faqs.questions.map(i => i.question + ' ' + i.answer).join(' ')\n // : '';\n const faqString = '';\n const html = data.body_html || data.descriptionHtml;\n const bodyString =\n html?.length > 0\n ? html\n .replace(/<\\/?[^>]+(>|$)/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim()\n : '';\n return [\n faqString,\n data.title,\n bodyString,\n data?.metafields_avadaSEO_after_content,\n data.metafields_global_title_tag,\n data.metafields_global_description_tag\n ]\n .join(' ')\n .toLowerCase();\n};\n\nconst escapeRegExp = string => {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n};\n\n/**\n *\n * @param related_keywords\n * @param string\n * @returns {{totalWordUsed: number, words: {}, isWordUsedExceeding: boolean}}\n */\nconst countWordsInRelatedKeywords = ({related_keywords, string}) => {\n const total = string.split(/\\s+/).filter(word => word.length > 0).length;\n const words = {};\n let totalWordUsed = 0;\n let isWordUsedExceeding = false;\n\n related_keywords.forEach(({text}) => {\n const keyword = text.toLocaleLowerCase();\n const escapedKeyword = escapeRegExp(keyword);\n const regex = new RegExp(`(?:^|\\\\W)${escapedKeyword}(?:\\\\W|$)`, 'gu');\n const length = (string.match(regex) || []).length;\n\n const percentage = parseFloat(((length / total) * 100).toFixed(1));\n if (!isWordUsedExceeding) {\n isWordUsedExceeding = percentage > 1;\n }\n totalWordUsed += length;\n words[text] = {length, percentage};\n });\n\n return {totalWordUsed, words, isWordUsedExceeding};\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAASA,KAAK,EAAEC,UAAU,EAAE;EACzC,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAAC,CAAC;EAC5B,MAAMC,gBAAgB,GAAGC,uBAAuB,CAACH,IAAI,EAAEE,gBAAgB,IAAI,EAAE,CAAC;EAC9E,MAAME,MAAM,GAAGC,eAAe,CAACL,IAAI,CAAC;EACpC,OAAOM,2BAA2B,CAAC;IAACJ,gBAAgB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,aAAa,GAAG,CAAC;EACrB,IAAIC,mBAAmB,GAAG,KAAK;EAE/B9B,gBAAgB,CAAC+B,OAAO,CAAC,CAAC;IAACvB;EAAI,CAAC,KAAK;IACnC,MAAMD,OAAO,GAAGC,IAAI,CAACwB,iBAAiB,CAAC,CAAC;IACxC,MAAMC,cAAc,GAAGV,YAAY,CAAChB,OAAO,CAAC;IAC5C,MAAM2B,KAAK,GAAG,IAAIC,MAAM,CAAC,YAAYF,cAAc,WAAW,EAAE,IAAI,CAAC;IACrE,MAAMnB,MAAM,GAAG,CAACZ,MAAM,CAACkC,KAAK,CAACF,KAAK,CAAC,IAAI,EAAE,EAAEpB,MAAM;IAEjD,MAAMuB,UAAU,GAAGC,UAAU,CAAC,CAAExB,MAAM,GAAGU,KAAK,GAAI,GAAG,EAAEe,OAAO,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,CAACT,mBAAmB,EAAE;MACxBA,mBAAmB,GAAGO,UAAU,GAAG,CAAC;IACtC;IACAR,aAAa,IAAIf,MAAM;IACvBc,KAAK,CAACpB,IAAI,CAAC,GAAG;MAACM,MAAM;MAAEuB;IAAU,CAAC;EACpC,CAAC,CAAC;EAEF,OAAO;IAACR,aAAa;IAAED,KAAK;IAAEE;EAAmB,CAAC;AACpD,CAAC","ignoreList":[]}
@@ -46,6 +46,7 @@ export default class RelatedKeywordsDensityAssessment extends Assessment {
46
46
  } = relatedKeywords;
47
47
  let status = 'good';
48
48
  const totalWords = Object.values(words).filter(word => word.percentage === 0);
49
+ console.log("Related keyword density check: ", !hasDescription, isEmpty(words), totalWords.length > 0);
49
50
  if (!hasDescription || isEmpty(words) || totalWords.length > 0) {
50
51
  status = 'bad';
51
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RelatedKeywordsDensityAssessment.js","names":["isEmpty","merge","AssessmentResult","Assessment","MAIN_CONTENT_POINTS","RELATED_KEYWORDS_DENSITY_ID","RelatedKeywordsDensityAssessment","constructor","config","defaultConfig","id","fixPosition","ctaType","docUrl","priority","title","content","good","bad","improve","identifier","_config","calculateResult","data","relatedKeywords","hasDescription","words","status","totalWords","Object","values","filter","word","percentage","length","score","getScore","getResult","paper","researcher","getResearch","getData","result","assessmentResult","setScore","setStatus","setData","isApplicable"],"sources":["../../../../../src/scoring/assessments/seo/RelatedKeywordsDensityAssessment.js"],"sourcesContent":["import {isEmpty, merge} from 'lodash';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport Assessment from '../assessment';\nimport {MAIN_CONTENT_POINTS, RELATED_KEYWORDS_DENSITY_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents the assessment that checks whether there are enough transition words in the text.\n */\nexport default class RelatedKeywordsDensityAssessment 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: RELATED_KEYWORDS_DENSITY_ID,\n fixPosition: 'description',\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#related-keywords',\n priority: 'high',\n title: 'Related keywords density',\n content: {\n good: 'Related keywords density optimized',\n bad:\n 'Use each secondary keyword from 0.5% to 1%. Place where it reads naturally.',\n improve: ''\n }\n };\n\n this.identifier = RELATED_KEYWORDS_DENSITY_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n *\n * @param data\n * @param relatedKeywords\n * @param hasDescription\n * @returns {{score: number, status: string, words}}\n */\n calculateResult(data, relatedKeywords, hasDescription) {\n const {words} = relatedKeywords;\n let status = 'good';\n const totalWords = Object.values(words).filter(word => word.percentage === 0);\n if(!hasDescription || isEmpty(words) || totalWords.length > 0){\n status = 'bad';\n }\n const score = this.getScore(MAIN_CONTENT_POINTS, status);\n\n return {\n score,\n status,\n words\n };\n }\n\n /**\n *\n * @param paper\n * @param researcher\n * @returns {AssessmentResult}\n */\n getResult({paper, researcher}) {\n const relatedKeywords = researcher.getResearch('checkRelatedKeywords');\n const data = paper.getData();\n const hasDescription = paper.hasDescription();\n const result = this.calculateResult(data, relatedKeywords, hasDescription);\n const assessmentResult = new AssessmentResult({config: this._config});\n\n assessmentResult.setScore(result.score);\n assessmentResult.setStatus(result.status);\n assessmentResult.setData(result.words);\n\n return assessmentResult;\n }\n\n /**\n * Checks if the transition words assessment is applicable to the paper. Language-specific length requirements and methods of counting text length\n * may apply (e.g. for Japanese, the text should be counted in characters instead of words, which also makes the minimum required length higher).\n *\n * @param {Paper} paper The paper to check.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} Returns true if the language is available, the paper is not empty and the text is longer than the minimum required length.\n */\n isApplicable(paper, researcher) {\n return true;\n }\n}\n"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,KAAK,QAAO,QAAQ;AACrC,OAAOC,gBAAgB;AACvB,OAAOC,UAAU;AACjB,SAAQC,mBAAmB,EAAEC,2BAA2B;;AAExD;AACA;AACA;AACA,eAAe,MAAMC,gCAAgC,SAASH,UAAU,CAAC;EACvE;AACF;AACA;AACA;AACA;AACA;AACA;EACEI,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEL,2BAA2B;MAC/BM,WAAW,EAAE,aAAa;MAC1BC,OAAO,EAAE,KAAK;MACdC,MAAM,EACJ,8FAA8F;MAChGC,QAAQ,EAAE,MAAM;MAChBC,KAAK,EAAE,0BAA0B;MACjCC,OAAO,EAAE;QACPC,IAAI,EAAE,oCAAoC;QAC1CC,GAAG,EACD,6EAA6E;QAC/EC,OAAO,EAAE;MACX;IACF,CAAC;IAED,IAAI,CAACC,UAAU,GAAGf,2BAA2B;IAC7C,IAAI,CAACgB,OAAO,GAAGpB,KAAK,CAACQ,aAAa,EAAED,MAAM,CAAC;EAC7C;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEc,eAAeA,CAACC,IAAI,EAAEC,eAAe,EAAEC,cAAc,EAAE;I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AAU,EAAE;IAC9B,OAAO,IAAI;EACb;AACF","ignoreList":[]}
1
+ {"version":3,"file":"RelatedKeywordsDensityAssessment.js","names":["isEmpty","merge","AssessmentResult","Assessment","MAIN_CONTENT_POINTS","RELATED_KEYWORDS_DENSITY_ID","RelatedKeywordsDensityAssessment","constructor","config","defaultConfig","id","fixPosition","ctaType","docUrl","priority","title","content","good","bad","improve","identifier","_config","calculateResult","data","relatedKeywords","hasDescription","words","status","totalWords","Object","values","filter","word","percentage","console","log","length","score","getScore","getResult","paper","researcher","getResearch","getData","result","assessmentResult","setScore","setStatus","setData","isApplicable"],"sources":["../../../../../src/scoring/assessments/seo/RelatedKeywordsDensityAssessment.js"],"sourcesContent":["import {isEmpty, merge} from 'lodash';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport Assessment from '../assessment';\nimport {MAIN_CONTENT_POINTS, RELATED_KEYWORDS_DENSITY_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents the assessment that checks whether there are enough transition words in the text.\n */\nexport default class RelatedKeywordsDensityAssessment 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: RELATED_KEYWORDS_DENSITY_ID,\n fixPosition: 'description',\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#related-keywords',\n priority: 'high',\n title: 'Related keywords density',\n content: {\n good: 'Related keywords density optimized',\n bad:\n 'Use each secondary keyword from 0.5% to 1%. Place where it reads naturally.',\n improve: ''\n }\n };\n\n this.identifier = RELATED_KEYWORDS_DENSITY_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n *\n * @param data\n * @param relatedKeywords\n * @param hasDescription\n * @returns {{score: number, status: string, words}}\n */\n calculateResult(data, relatedKeywords, hasDescription) {\n const {words} = relatedKeywords;\n let status = 'good';\n const totalWords = Object.values(words).filter(word => word.percentage === 0);\n console.log(\"Related keyword density check: \", !hasDescription, isEmpty(words), totalWords.length > 0);\n if(!hasDescription || isEmpty(words) || totalWords.length > 0){\n status = 'bad';\n }\n const score = this.getScore(MAIN_CONTENT_POINTS, status);\n\n return {\n score,\n status,\n words\n };\n }\n\n /**\n *\n * @param paper\n * @param researcher\n * @returns {AssessmentResult}\n */\n getResult({paper, researcher}) {\n const relatedKeywords = researcher.getResearch('checkRelatedKeywords');\n const data = paper.getData();\n const hasDescription = paper.hasDescription();\n const result = this.calculateResult(data, relatedKeywords, hasDescription);\n const assessmentResult = new AssessmentResult({config: this._config});\n\n assessmentResult.setScore(result.score);\n assessmentResult.setStatus(result.status);\n assessmentResult.setData(result.words);\n\n return assessmentResult;\n }\n\n /**\n * Checks if the transition words assessment is applicable to the paper. Language-specific length requirements and methods of counting text length\n * may apply (e.g. for Japanese, the text should be counted in characters instead of words, which also makes the minimum required length higher).\n *\n * @param {Paper} paper The paper to check.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} Returns true if the language is available, the paper is not empty and the text is longer than the minimum required length.\n */\n isApplicable(paper, researcher) {\n return true;\n }\n}\n"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,KAAK,QAAO,QAAQ;AACrC,OAAOC,gBAAgB;AACvB,OAAOC,UAAU;AACjB,SAAQC,mBAAmB,EAAEC,2BAA2B;;AAExD;AACA;AACA;AACA,eAAe,MAAMC,gCAAgC,SAASH,UAAU,CAAC;EACvE;AACF;AACA;AACA;AACA;AACA;AACA;EACEI,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEL,2BAA2B;MAC/BM,WAAW,EAAE,aAAa;MAC1BC,OAAO,EAAE,KAAK;MACdC,MAAM,EACJ,8FAA8F;MAChGC,QAAQ,EAAE,MAAM;MAChBC,KAAK,EAAE,0BAA0B;MACjCC,OAAO,EAAE;QACPC,IAAI,EAAE,oCAAoC;QA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Ae,EAAEC,cAAc,CAAC;IAC1E,MAAMoB,gBAAgB,GAAG,IAAI3C,gBAAgB,CAAC;MAACM,MAAM,EAAE,IAAI,CAACa;IAAO,CAAC,CAAC;IAErEwB,gBAAgB,CAACC,QAAQ,CAACF,MAAM,CAACP,KAAK,CAAC;IACvCQ,gBAAgB,CAACE,SAAS,CAACH,MAAM,CAACjB,MAAM,CAAC;IACzCkB,gBAAgB,CAACG,OAAO,CAACJ,MAAM,CAAClB,KAAK,CAAC;IAEtC,OAAOmB,gBAAgB;EACzB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEI,YAAYA,CAACT,KAAK,EAAEC,UAAU,EAAE;IAC9B,OAAO,IAAI;EACb;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axyseo",
3
- "version": "2.1.52",
3
+ "version": "2.1.54",
4
4
  "main": "build/cjs/index.js",
5
5
  "module": "build/esm/index.js",
6
6
  "exports": {