Skip to content

Commit d726d4f

Browse files
refactor to use common lib
1 parent 329d0de commit d726d4f

8 files changed

Lines changed: 753 additions & 873 deletions

File tree

package-lock.json

Lines changed: 716 additions & 453 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"@adobe/helix-status": "10.1.5",
7777
"@adobe/helix-universal": "5.4.0",
7878
"@adobe/helix-universal-logger": "3.0.28",
79-
"@adobe/spacecat-shared-data-access": "3.22.0",
79+
"@adobe/spacecat-shared-data-access": "https://gist.github.com/tkotthakota-adobe/a882c8a25cbc82cb134ed75e831ef6bd/raw/89cfa44262f3d35bd008abf8240d05605d18cb71/adobe-spacecat-shared-data-access-3.31.0.tgz",
8080
"@adobe/spacecat-shared-data-access-v2": "npm:@adobe/spacecat-shared-data-access@2.109.0",
8181
"@adobe/spacecat-shared-google-client": "1.5.6",
8282
"@adobe/spacecat-shared-gpt-client": "1.6.19",
@@ -85,7 +85,7 @@
8585
"@adobe/spacecat-shared-rum-api-client": "2.40.9",
8686
"@adobe/spacecat-shared-scrape-client": "2.5.3",
8787
"@adobe/spacecat-shared-slack-client": "1.6.3",
88-
"@adobe/spacecat-shared-utils": "1.102.1",
88+
"@adobe/spacecat-shared-utils": "https://gist.github.com/tkotthakota-adobe/fe9c5d8edb227d23339db99d0293bc81/raw/9483f68938ed65df6d3dab50cf55c4d5c4cff113/adobe-spacecat-shared-utils-1.106.0.tgz",
8989
"@aws-sdk/client-lambda": "3.1009.0",
9090
"@aws-sdk/client-sqs": "3.1009.0",
9191
"@aws-sdk/client-s3": "3.1009.0",

src/tasks/opportunity-status-processor/audit-opportunity-map.js

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/tasks/opportunity-status-processor/handler.js

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ import { ok } from '@adobe/spacecat-shared-http-utils';
1414
import RUMAPIClient from '@adobe/spacecat-shared-rum-api-client';
1515
import GoogleClient from '@adobe/spacecat-shared-google-client';
1616
import { ScrapeClient } from '@adobe/spacecat-shared-scrape-client';
17-
import { resolveCanonicalUrl } from '@adobe/spacecat-shared-utils';
17+
import {
18+
resolveCanonicalUrl,
19+
getAuditsForOpportunity,
20+
getOpportunityTitle,
21+
OPPORTUNITY_DEPENDENCY_MAP,
22+
getOpportunitiesForAudit,
23+
} from '@adobe/spacecat-shared-utils';
1824
import { getAuditStatus } from '../../utils/cloudwatch-utils.js';
1925
import { checkAndAlertBotProtection } from '../../utils/bot-detection.js';
2026
import { say } from '../../utils/slack-utils.js';
21-
import { getOpportunitiesForAudit, getAuditsForOpportunity } from './audit-opportunity-map.js';
22-
import { OPPORTUNITY_DEPENDENCY_MAP } from './opportunity-dependency-map.js';
2327

2428
const TASK_TYPE = 'opportunity-status-processor';
2529

@@ -94,33 +98,6 @@ async function isGSCConfigured(siteUrl, context) {
9498
}
9599
}
96100

97-
/**
98-
* Gets the opportunity title from the opportunity type
99-
* @param {string} opportunityType - The opportunity type
100-
* @returns {string} The opportunity title
101-
*/
102-
function getOpportunityTitle(opportunityType) {
103-
const opportunityTitles = {
104-
cwv: 'Core Web Vitals',
105-
'meta-tags': 'SEO Meta Tags',
106-
'broken-backlinks': 'Broken Backlinks',
107-
'broken-internal-links': 'Broken Internal Links',
108-
'alt-text': 'Alt Text',
109-
sitemap: 'Sitemap',
110-
};
111-
112-
// Check if the opportunity type exists in our map
113-
if (opportunityTitles[opportunityType]) {
114-
return opportunityTitles[opportunityType];
115-
}
116-
117-
// Convert kebab-case to Title Case (e.g., "first-second" -> "First Second")
118-
return opportunityType
119-
.split('-')
120-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
121-
.join(' ');
122-
}
123-
124101
/**
125102
* Filters scrape jobs to only include those created after onboardStartTime
126103
* This ensures we only check jobs from the CURRENT onboarding session,

src/tasks/opportunity-status-processor/opportunity-dependency-map.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

test/tasks/opportunity-status-processor/audit-opportunity-map.test.js

Lines changed: 0 additions & 176 deletions
This file was deleted.

0 commit comments

Comments
 (0)