Skip to content

Commit

Permalink
Merge main (v1.1.0) into develop (#348)
Browse files Browse the repository at this point in the history
Merge main (v1.1.0) into develop
  • Loading branch information
nmanu1 committed Dec 15, 2022
2 parents cc65e8b + 65ae41d commit 79732b1
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 77 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/sync-sites-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ on:
push:
branches:
- main

jobs:
sync-branches:
runs-on: ubuntu-latest
name: Syncing branches
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: mtanzi/action-automerge@v1
uses: actions/checkout@v3
- uses: devmasx/merge-branch@v1.4.0
with:
source: "${{ github.event.repository.default_branch }}"
target: "storybook-site"
type: now
from_branch: ${{ github.event.repository.default_branch }}
target_branch: storybook-site
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: mtanzi/action-automerge@v1
- uses: devmasx/merge-branch@v1.4.0
with:
source: "${{ github.event.repository.default_branch }}"
target: "test-site"
type: now
from_branch: ${{ github.event.repository.default_branch }}
target_branch: test-site
github_token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions THIRD-PARTY-NOTICES
Original file line number Diff line number Diff line change
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.0.0
- @yext/search-core@2.1.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.0.1
- @yext/search-headless-react@2.1.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.0.0
- @yext/search-headless@2.1.0

This package contains the following license and notice below:

Expand Down
110 changes: 56 additions & 54 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yext/search-ui-react",
"version": "1.0.2",
"version": "1.1.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.0.1",
"@yext/search-headless-react": "^2.1.0",
"axe-playwright": "^1.1.11",
"babel-jest": "^27.0.6",
"eslint": "^8.11.0",
Expand All @@ -93,7 +93,7 @@
"typescript": "~4.5.5"
},
"peerDependencies": {
"@yext/search-headless-react": "^2.0.1",
"@yext/search-headless-react": "^2.1.0",
"react": "^16.14 || ^17 || ^18",
"react-dom": "^16.14 || ^17 || ^18"
},
Expand Down
20 changes: 14 additions & 6 deletions src/components/FilterSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ export function FilterSearch({
const searchParamFields = searchFields.map((searchField) => {
return { ...searchField, fetchEntities: false };
});
const matchingFieldIds: Set<string> = useMemo(() => {
const fieldIds = new Set(searchFields.map(s => s.fieldApiName));
if (fieldIds.has('builtin.location')) {
['builtin.region', 'address.countryCode'].forEach(s => fieldIds.add(s));
}
return fieldIds;
}, [searchFields]);

const cssClasses = useComposedCssClasses(builtInCssClasses, customCssClasses);
const [currentFilter, setCurrentFilter] = useState<StaticFilter>();
const [filterQuery, setFilterQuery] = useState<string>();
Expand All @@ -113,9 +121,9 @@ export function FilterSearch({
return staticFilters?.filter(({ filter, selected }) =>
selected
&& filter.kind === 'fieldValue'
&& searchFields.some(s => s.fieldApiName === filter.fieldId)
&& matchingFieldIds.has(filter.fieldId)
) ?? [];
}, [staticFilters, searchFields]);
}, [staticFilters, matchingFieldIds]);

const [
filterSearchResponse,
Expand All @@ -132,7 +140,7 @@ export function FilterSearch({
useEffect(() => {
if (matchingFilters.length > 1 && !onSelect) {
console.warn('More than one selected static filter found that matches the filter search fields: ['
+ searchFields.map(s => s.fieldApiName).join(', ')
+ [...matchingFieldIds].join(', ')
+ ']. Please update the state to remove the extra filters.'
+ ' Picking one filter to display in the input.');
}
Expand All @@ -158,7 +166,7 @@ export function FilterSearch({
executeFilterSearch,
onSelect,
matchingFilters,
searchFields
matchingFieldIds
]);

const sections = useMemo(() => {
Expand Down Expand Up @@ -190,7 +198,7 @@ export function FilterSearch({

if (matchingFilters.length > 1) {
console.warn('More than one selected static filter found that matches the filter search fields: ['
+ searchFields.map(s => s.fieldApiName).join(', ')
+ [...matchingFieldIds].join(', ')
+ ']. Unselecting all existing matching filters and selecting the new filter.');
}
matchingFilters.forEach(f => searchActions.setFilterOption({ filter: f.filter, selected: false }));
Expand All @@ -213,7 +221,7 @@ export function FilterSearch({
onSelect,
searchOnSelect,
matchingFilters,
searchFields
matchingFieldIds
]);

const meetsSubmitCritera = useCallback(index => index >= 0, []);
Expand Down
Loading

0 comments on commit 79732b1

Please sign in to comment.