Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
saahithjanapati committed Jul 24, 2023
2 parents aef4449 + ad5107e commit 8dd1185
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 73 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Semgrep - Team Vaccine
on:
workflow_dispatch: {}
pull_request: {}
push:
branches:
- main
- master
paths:
- .github/workflows/semgrep.yml
schedule:
# random HH:MM to avoid a load spike on GitHub Actions at 00:00
- cron: '0 2 * * *'
jobs:
semgrep:
name: semgrep/ci
runs-on: ubuntu-20.04
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN_VACCINE }}
container:
image: returntocorp/semgrep
if: (github.actor != 'dependabot[bot]')
steps:
- uses: actions/checkout@v3
- run: semgrep ci
10 changes: 0 additions & 10 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ name: Run Tests
on: [push, pull_request]

jobs:
call_run_tests-react-18:
uses: yext/slapshot-reusable-workflows/.github/workflows/run_tests.yml@v1
with:
build_script: |
npm i -D react@18 react-dom@18
npm run build
node_matrix: '["14.x", "16.x", "18.x"]'
secrets:
MAPBOX_API_KEY: ${{ secrets.MAPBOX_API_KEY }}

call_run_tests-react-17:
uses: yext/slapshot-reusable-workflows/.github/workflows/run_tests.yml@v1
with:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ lib/

.env
test-site/.env

.idea/
8 changes: 4 additions & 4 deletions THIRD-PARTY-NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ These definitions were written by Chi Vinh Le <https://github.com/cvle>.

The following NPM package may be included in this product:

- @yext/analytics@0.2.0-beta.3
- @yext/analytics@0.5.0

This package contains the following license and notice below:

Expand Down Expand Up @@ -1020,7 +1020,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The following NPM package may be included in this product:

- @yext/search-core@2.3.0
- @yext/search-core@2.4.0

This package contains the following license and notice below:

Expand Down Expand Up @@ -1064,7 +1064,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The following NPM package may be included in this product:

- @yext/search-headless-react@2.2.0
- @yext/search-headless-react@2.3.0

This package contains the following license and notice below:

Expand Down Expand Up @@ -1108,7 +1108,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The following NPM package may be included in this product:

- @yext/search-headless@2.3.0
- @yext/search-headless@2.4.0

This package contains the following license and notice below:

Expand Down
74 changes: 38 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yext/search-ui-react",
"version": "1.3.0-beta.1",
"version": "1.3.0",
"description": "A library of React Components for powering Yext Search integrations",
"author": "slapshot@yext.com",
"license": "BSD-3-Clause",
Expand Down Expand Up @@ -76,7 +76,7 @@
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"@yext/eslint-config-slapshot": "^0.5.0",
"@yext/search-headless-react": "^2.2.0",
"@yext/search-headless-react": "2.3.0",
"axe-playwright": "^1.1.11",
"babel-jest": "^27.0.6",
"eslint": "^8.11.0",
Expand All @@ -93,9 +93,9 @@
"typescript": "~4.5.5"
},
"peerDependencies": {
"@yext/search-headless-react": "^2.2.0",
"react": "^16.14 || ^17 || ^18",
"react-dom": "^16.14 || ^17 || ^18"
"@yext/search-headless-react": "2.3.0",
"react": "^16.14 || ^17",
"react-dom": "^16.14 || ^17"
},
"jest": {
"bail": 0,
Expand Down Expand Up @@ -141,12 +141,12 @@
"@reach/auto-id": "^0.18.0",
"@restart/ui": "^1.0.1",
"@tailwindcss/forms": "^0.5.0",
"@yext/analytics": "^0.2.0-beta.3",
"@yext/analytics": "^0.5.0",
"classnames": "^2.3.1",
"lodash": "^4.17.21",
"mapbox-gl": "^2.9.2",
"prop-types": "^15.8.1",
"react-collapsed": "~3.6.0",
"react-collapsed": "3.6.0",
"recent-searches": "^1.0.5",
"tailwind-merge": "^1.3.0",
"use-isomorphic-layout-effect": "^1.1.2"
Expand Down
24 changes: 20 additions & 4 deletions src/components/FeaturedSnippetDirectAnswer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FeaturedSnippetDirectAnswer as FeaturedSnippetDirectAnswerType } from '@yext/search-headless-react';
import { renderHighlightedValue } from './utils/renderHighlightedValue';
import { useMemo } from 'react';

/**
* Props for {@link FeaturedSnippetDirectAnswer}.
Expand Down Expand Up @@ -29,17 +30,32 @@ interface FeaturedSnippetDirectAnswerCssClasses {
*
* @internal
*/

const unsupportedTextFormats: string[] = ['rich_text', 'rich_text_v2', 'markdown'];

export function FeaturedSnippetDirectAnswer({
result,
readMoreClickHandler,
cssClasses = {}
}: FeaturedSnippetDirectAnswerProps): JSX.Element {
const answer = result.fieldType === 'multi_line_text' && result.value;
// TODO: SLAP-2340, update rich text snippets to convert the markdown
if (result.fieldType === 'rich_text') {
console.warn('Rendering markdown for rich text direct answer is currently not supported. Displaying the unrendered markdown string as is.');
if (unsupportedTextFormats.includes(result.fieldType)) {
console.warn('Rendering ' + result.fieldType + ' direct answer is currently not supported. ' +
'You can modify your search configuration to convert ' + result.fieldType + ' to HTML to be rendered '
+ 'on the page.');
}
let snippet: JSX.Element;
const snippetValue = useMemo(() =>
{ return { __html: result.snippet?.value }; }, [result.snippet?.value]);

if (result.fieldType === 'html') {
snippet = (
<div dangerouslySetInnerHTML={snippetValue}></div>
);
}
else {
snippet = renderHighlightedValue(result.snippet, { highlighted: cssClasses.highlighted });
}
const snippet = renderHighlightedValue(result.snippet, { highlighted: cssClasses.highlighted });
const link = result.relatedResult.link || result.relatedResult.rawData.landingPageUrl as string;
const name = result.relatedResult.name;
const snippetLinkMessage = 'Read more about ';
Expand Down
Loading

0 comments on commit 8dd1185

Please sign in to comment.