Skip to content

Commit

Permalink
[W-16713536] migrate Coveo to UAT (#792)
Browse files Browse the repository at this point in the history
* migrate UA to salesforce-dev

* Bump serve-static from 1.15.0 to 1.16.2

Bumps [serve-static](https://github.com/expressjs/serve-static) from 1.15.0 to 1.16.2.
- [Release notes](https://github.com/expressjs/serve-static/releases)
- [Changelog](https://github.com/expressjs/serve-static/blob/v1.16.2/HISTORY.md)
- [Commits](expressjs/serve-static@v1.15.0...v1.16.2)

---
updated-dependencies:
- dependency-name: serve-static
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* handle error if element doesn't exist

* vuln patch

* upgrade coveo ver

* revert - open page in same tab

* update search hub

* keep content recommendations to old org

* update search hub

* switch to UAT

* no more hardcoding token

* forcing fallback links for now until migration is done

* comment out unused func for now

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
cheungaryk and dependabot[bot] authored Sep 16, 2024
1 parent 7819ea2 commit 0070180
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
28 changes: 14 additions & 14 deletions src/js/25-trending-topics-fallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@
}
}

const hasValidRecommendations = (recsListShadowRoot) => {
if (recsListShadowRoot.childElementCount === 0) return false
const atomicRecsResult = recsListShadowRoot.querySelector('atomic-recs-result')
if (atomicRecsResult) {
const recsResultShadowRoot = atomicRecsResult.shadowRoot
const atomicText = recsResultShadowRoot.querySelector('atomic-text')
return atomicText?.value !== 'no-title'
}
return true
}
// const hasValidRecommendations = (recsListShadowRoot) => {
// if (recsListShadowRoot.childElementCount === 0) return false
// const atomicRecsResult = recsListShadowRoot.querySelector('atomic-recs-result')
// if (atomicRecsResult) {
// const recsResultShadowRoot = atomicRecsResult.shadowRoot
// const atomicText = recsResultShadowRoot.querySelector('atomic-text')
// return atomicText?.value !== 'no-title'
// }
// return true
// }

setTimeout(() => {
const atomicRecsList = document.querySelector('atomic-recs-list')
const recsListShadowRoot = atomicRecsList?.shadowRoot
if (recsListShadowRoot) {
try {
if (!hasValidRecommendations(recsListShadowRoot)) {
addFallbackLinks(atomicRecsList.parentElement.parentElement)
atomicRecsList.parentElement.remove()
}
// if (!hasValidRecommendations(recsListShadowRoot)) {
addFallbackLinks(atomicRecsList.parentElement.parentElement)
atomicRecsList.parentElement.remove()
// }
} catch (error) {
console.error(error)
}
Expand Down
4 changes: 2 additions & 2 deletions src/partials/head/head-scripts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{{> segment-script }}
{{/if}}
{{#if (or env.COVEO_API_KEY env.COVEO_API_KEY_JP)}}
{{> coveo-search-scripts org_id="coveosalesforcetestakshatha"}}
{{> coveo-ua-script org_id="coveosalesforcetestakshatha"}}
{{> coveo-search-scripts org_id="fullsalesforce"}}
{{> coveo-ua-script org_id="fullsalesforce"}}
{{/if}}
{{#if (eq (site-profile) 'review' )}}
{{> review-site-scripts }}
Expand Down
10 changes: 5 additions & 5 deletions src/partials/head/head-scripts/coveo-search-scripts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
}
}
// no need to hide this token - it has extremely limited privilege and will show in the source code anyway
// TODO: store the CR token in Jenkins so it's easier to rotate if needed
const crToken = "xxb149e86e-a23c-43f6-9840-95d0bfa55830";
initContentRecommendations('mulesoftprodqzggq6re', crToken);
{{#if (or env.COVEO_CR_API_KEY env.COVEO_CR_API_KEY_JP)}}
const organizationId = "{{ org_id }}";
const crToken = "{{#if (eq (site-profile) 'jp')}}{{env.COVEO_CR_API_KEY_JP}}{{else}}{{env.COVEO_CR_API_KEY}}{{/if}}"
initContentRecommendations(organizationId, crToken);
{{/if}}
})();
</script>
2 changes: 1 addition & 1 deletion src/partials/landing-page/trending-topics.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="sect2">
<atomic-recs-interface id="recs" pipeline="MS Docs Site - Trending Topics{{#if (eq (site-profile) 'jp' )}} JP{{/if}}" search-hub="Trending Topics{{#if (eq (site-profile) 'jp' )}} JP{{/if}}">
<atomic-recs-interface id="recs" pipeline="MS Docs Site - Trending Topics{{#if (eq (site-profile) 'jp' )}} JP{{/if}}" search-hub="mulesoft-docs-trending-topics{{#if (eq (site-profile) 'jp' )}}-jp{{/if}}">
<atomic-recs-list density="compact" heading-level=2 label="{{#if (eq (site-profile) 'jp' )}}トレンドトピック{{else}}Trending Topics{{/if}}" number-of-recommendations=7>
<atomic-recs-result-template>
<template>
Expand Down

0 comments on commit 0070180

Please sign in to comment.