From fc56e34d3d27571972af51ea1f44e8bcee19f023 Mon Sep 17 00:00:00 2001 From: nmanu1 <88398086+nmanu1@users.noreply.github.com> Date: Mon, 18 Jul 2022 09:06:52 -0400 Subject: [PATCH 1/6] Bump Core version (#120) Bump the Core version to include the changes to make `Result` a generic. J=SLAP-2232 TEST=none --- THIRD-PARTY-NOTICES | 2 +- docs/search-headless.result.entitytype.md | 2 +- docs/search-headless.result.md | 6 +++--- docs/search-headless.result.rawdata.md | 2 +- etc/search-headless.api.md | 4 ++-- package-lock.json | 18 +++++++++--------- package.json | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/THIRD-PARTY-NOTICES b/THIRD-PARTY-NOTICES index 8c826c40..900847ee 100644 --- a/THIRD-PARTY-NOTICES +++ b/THIRD-PARTY-NOTICES @@ -62,7 +62,7 @@ SOFTWARE. The following NPM package may be included in this product: - - @yext/search-core@1.8.0 + - @yext/search-core@1.9.0-alpha.188 This package contains the following license and notice below: diff --git a/docs/search-headless.result.entitytype.md b/docs/search-headless.result.entitytype.md index 26c8978a..adf4315f 100644 --- a/docs/search-headless.result.entitytype.md +++ b/docs/search-headless.result.entitytype.md @@ -4,7 +4,7 @@ ## Result.entityType property -The entity type of the result +The entity type of the result. Signature: diff --git a/docs/search-headless.result.md b/docs/search-headless.result.md index 5a9a7853..5bd01582 100644 --- a/docs/search-headless.result.md +++ b/docs/search-headless.result.md @@ -9,7 +9,7 @@ An individual search result. Signature: ```typescript -export declare interface Result +export declare interface Result> ``` ## Properties @@ -19,12 +19,12 @@ export declare interface Result | [description?](./search-headless.result.description.md) | string | (Optional) A description of the result. | | [distance?](./search-headless.result.distance.md) | number | (Optional) The distance from the user to the result in meters. | | [distanceFromFilter?](./search-headless.result.distancefromfilter.md) | number | (Optional) The distance from a [AppliedQueryFilter](./search-headless.appliedqueryfilter.md) location to the result in meters. | -| [entityType?](./search-headless.result.entitytype.md) | string | (Optional) The entity type of the result | +| [entityType?](./search-headless.result.entitytype.md) | string | (Optional) The entity type of the result. | | [highlightedFields?](./search-headless.result.highlightedfields.md) | [HighlightedFields](./search-headless.highlightedfields.md) | (Optional) The [highlighted fields](./search-headless.highlightedfields.md) emphasized by the api. | | [id?](./search-headless.result.id.md) | string | (Optional) The result ID which depends on the Result Source. | | [index?](./search-headless.result.index.md) | number | (Optional) The index of the result among the other results in the search. | | [link?](./search-headless.result.link.md) | string | (Optional) A hyperlink associated with the result. | | [name?](./search-headless.result.name.md) | string | (Optional) The name of the result. | -| [rawData](./search-headless.result.rawdata.md) | Record<string, unknown> | Raw entity profile data in the shape of key-value pairs. | +| [rawData](./search-headless.result.rawdata.md) | T | Raw entity profile data in the shape of key-value pairs. | | [source](./search-headless.result.source.md) | [Source](./search-headless.source.md) | Represents the source of a [Result](./search-headless.result.md). | diff --git a/docs/search-headless.result.rawdata.md b/docs/search-headless.result.rawdata.md index d01e62df..0e3e762f 100644 --- a/docs/search-headless.result.rawdata.md +++ b/docs/search-headless.result.rawdata.md @@ -9,5 +9,5 @@ Raw entity profile data in the shape of key-value pairs. Signature: ```typescript -rawData: Record; +rawData: T; ``` diff --git a/etc/search-headless.api.md b/etc/search-headless.api.md index c3b46e7e..394b087b 100644 --- a/etc/search-headless.api.md +++ b/etc/search-headless.api.md @@ -492,7 +492,7 @@ export interface RangeBoundary { } // @public -export interface Result { +export interface Result> { description?: string; distance?: number; distanceFromFilter?: number; @@ -502,7 +502,7 @@ export interface Result { index?: number; link?: string; name?: string; - rawData: Record; + rawData: T; source: Source; } diff --git a/package-lock.json b/package-lock.json index e253e957..dce3df58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,16 @@ { "name": "@yext/search-headless", - "version": "1.3.0", + "version": "1.4.0-alpha.120", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/search-headless", - "version": "1.3.0", + "version": "1.4.0-alpha.120", "license": "BSD-3-Clause", "dependencies": { "@reduxjs/toolkit": "^1.8.1", - "@yext/search-core": "^1.8.0", + "@yext/search-core": "^1.9.0-alpha.188", "js-levenshtein": "^1.1.6", "lodash": "^4.17.21" }, @@ -4686,9 +4686,9 @@ } }, "node_modules/@yext/search-core": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@yext/search-core/-/search-core-1.8.0.tgz", - "integrity": "sha512-t7rg9JZ9K6pIt2nBZ1O+xhzG+zMFVAu9Vgwh8cTey8NA7878cQ6n6BauTwimVdbrNGHq3D2dPUno/kVtKAgPiQ==", + "version": "1.9.0-alpha.188", + "resolved": "https://registry.npmjs.org/@yext/search-core/-/search-core-1.9.0-alpha.188.tgz", + "integrity": "sha512-g1agribhx3/B0KN8zWcsL9BL+3/v+qxTKQ2jahP4lpMmMSAxeO/rZUcXolNP47yoe37nDRiRmWEpM1ORTgrcOw==", "dependencies": { "@babel/runtime-corejs3": "^7.12.5", "cross-fetch": "^3.1.5" @@ -16349,9 +16349,9 @@ } }, "@yext/search-core": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@yext/search-core/-/search-core-1.8.0.tgz", - "integrity": "sha512-t7rg9JZ9K6pIt2nBZ1O+xhzG+zMFVAu9Vgwh8cTey8NA7878cQ6n6BauTwimVdbrNGHq3D2dPUno/kVtKAgPiQ==", + "version": "1.9.0-alpha.188", + "resolved": "https://registry.npmjs.org/@yext/search-core/-/search-core-1.9.0-alpha.188.tgz", + "integrity": "sha512-g1agribhx3/B0KN8zWcsL9BL+3/v+qxTKQ2jahP4lpMmMSAxeO/rZUcXolNP47yoe37nDRiRmWEpM1ORTgrcOw==", "requires": { "@babel/runtime-corejs3": "^7.12.5", "cross-fetch": "^3.1.5" diff --git a/package.json b/package.json index a9214bec..e3c6515c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/search-headless", - "version": "1.3.0", + "version": "1.4.0-alpha.120", "description": "A library for powering UI components for Yext Search integrations", "author": "slapshot@yext.com", "license": "BSD-3-Clause", @@ -29,7 +29,7 @@ }, "dependencies": { "@reduxjs/toolkit": "^1.8.1", - "@yext/search-core": "^1.8.0", + "@yext/search-core": "^1.9.0-alpha.188", "js-levenshtein": "^1.1.6", "lodash": "^4.17.21" }, From e7b89e6fc099a69bb086a65a2ad09d5e22140955 Mon Sep 17 00:00:00 2001 From: Cindy <74145775+ElemelonWind@users.noreply.github.com> Date: Mon, 18 Jul 2022 11:31:04 -0400 Subject: [PATCH 2/6] Added version and license to readme (#124) --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 70dd7d91..6459585c 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,14 @@ A library for powering UI components for Yext Search integrations. [Full Documentation](./docs/search-headless.md) - - Coverage Status - + From d0b31b4d938ddffcb755bee58811498b3588ef89 Mon Sep 17 00:00:00 2001 From: Alex Taing <59857107+alextaing@users.noreply.github.com> Date: Tue, 26 Jul 2022 13:29:16 -0400 Subject: [PATCH 3/6] Make matchedSubstrings accessible (#126) [Raiden needs access](https://yext.slack.com/archives/C03NQ9X8ACB/p1658505872261039) to `matchedSubstrings` from the spellCheck part of the Search API response. Since changing `correctedQuery` from a string to an object would be a breaking change, we added a new property to the spellCheck interface that holds the `matchedSubstrings`. This PR updates the version number of Core used to introduce `matchedSubstrings`. J=SLAP-2274 TEST=auto, manual Automatic tests were updated to include `matchedSubstrings` in the SpellCheck objects. Manual testing was performed using the test-site-node. It was checked that on search "virgimia", a `matchedSubstrings` list was returned with correct values. It was also checked that on search "virginia" remained functional. --- THIRD-PARTY-NOTICES | 2 +- ...arch-headless.spellcheck.matchedsubstrings.md | 16 ++++++++++++++++ docs/search-headless.spellcheck.md | 1 + etc/search-headless.api.md | 4 ++++ package-lock.json | 14 +++++++------- package.json | 2 +- test-site-node/package-lock.json | 16 ++++++++-------- tests/integration/spellcheck.ts | 6 +++++- tests/unit/slices/spellcheck.ts | 6 +++++- 9 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 docs/search-headless.spellcheck.matchedsubstrings.md diff --git a/THIRD-PARTY-NOTICES b/THIRD-PARTY-NOTICES index 900847ee..92ce4c16 100644 --- a/THIRD-PARTY-NOTICES +++ b/THIRD-PARTY-NOTICES @@ -62,7 +62,7 @@ SOFTWARE. The following NPM package may be included in this product: - - @yext/search-core@1.9.0-alpha.188 + - @yext/search-core@1.9.0-beta.193 This package contains the following license and notice below: diff --git a/docs/search-headless.spellcheck.matchedsubstrings.md b/docs/search-headless.spellcheck.matchedsubstrings.md new file mode 100644 index 00000000..e99eb08b --- /dev/null +++ b/docs/search-headless.spellcheck.matchedsubstrings.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [@yext/search-headless](./search-headless.md) > [SpellCheck](./search-headless.spellcheck.md) > [matchedSubstrings](./search-headless.spellcheck.matchedsubstrings.md) + +## SpellCheck.matchedSubstrings property + +An array of substring matches which correspond to the highlighting. Offset indicates the index of the match, and the length indicates the number of characters of the match. + +Signature: + +```typescript +matchedSubstrings: { + length: number; + offset: number; + }[]; +``` diff --git a/docs/search-headless.spellcheck.md b/docs/search-headless.spellcheck.md index 5943a31e..dfae9760 100644 --- a/docs/search-headless.spellcheck.md +++ b/docs/search-headless.spellcheck.md @@ -17,6 +17,7 @@ export declare interface SpellCheck | Property | Type | Description | | --- | --- | --- | | [correctedQuery](./search-headless.spellcheck.correctedquery.md) | string | The corrected version of the originalQuery. | +| [matchedSubstrings](./search-headless.spellcheck.matchedsubstrings.md) | { length: number; offset: number; }\[\] | An array of substring matches which correspond to the highlighting. Offset indicates the index of the match, and the length indicates the number of characters of the match. | | [originalQuery](./search-headless.spellcheck.originalquery.md) | string | The query that was input into the spell checker. | | [type](./search-headless.spellcheck.type.md) | [SpellCheckType](./search-headless.spellchecktype.md) | The type of spell check. | diff --git a/etc/search-headless.api.md b/etc/search-headless.api.md index 394b087b..33c29692 100644 --- a/etc/search-headless.api.md +++ b/etc/search-headless.api.md @@ -677,6 +677,10 @@ export enum Source { // @public export interface SpellCheck { correctedQuery: string; + matchedSubstrings: { + length: number; + offset: number; + }[]; originalQuery: string; type: SpellCheckType; } diff --git a/package-lock.json b/package-lock.json index dce3df58..ca1b1528 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "BSD-3-Clause", "dependencies": { "@reduxjs/toolkit": "^1.8.1", - "@yext/search-core": "^1.9.0-alpha.188", + "@yext/search-core": "^1.9.0-beta.193", "js-levenshtein": "^1.1.6", "lodash": "^4.17.21" }, @@ -4686,9 +4686,9 @@ } }, "node_modules/@yext/search-core": { - "version": "1.9.0-alpha.188", - "resolved": "https://registry.npmjs.org/@yext/search-core/-/search-core-1.9.0-alpha.188.tgz", - "integrity": "sha512-g1agribhx3/B0KN8zWcsL9BL+3/v+qxTKQ2jahP4lpMmMSAxeO/rZUcXolNP47yoe37nDRiRmWEpM1ORTgrcOw==", + "version": "1.9.0-beta.193", + "resolved": "https://registry.npmjs.org/@yext/search-core/-/search-core-1.9.0-beta.193.tgz", + "integrity": "sha512-BXS9Zf9EQ30L8dmWPS59kK89l2AEQr1jnAI0vwhSW3rX4o2Y5qs5QxR/pOgTGx3piTfU+u3FJrtELf+2qSV1Bg==", "dependencies": { "@babel/runtime-corejs3": "^7.12.5", "cross-fetch": "^3.1.5" @@ -16349,9 +16349,9 @@ } }, "@yext/search-core": { - "version": "1.9.0-alpha.188", - "resolved": "https://registry.npmjs.org/@yext/search-core/-/search-core-1.9.0-alpha.188.tgz", - "integrity": "sha512-g1agribhx3/B0KN8zWcsL9BL+3/v+qxTKQ2jahP4lpMmMSAxeO/rZUcXolNP47yoe37nDRiRmWEpM1ORTgrcOw==", + "version": "1.9.0-beta.193", + "resolved": "https://registry.npmjs.org/@yext/search-core/-/search-core-1.9.0-beta.193.tgz", + "integrity": "sha512-BXS9Zf9EQ30L8dmWPS59kK89l2AEQr1jnAI0vwhSW3rX4o2Y5qs5QxR/pOgTGx3piTfU+u3FJrtELf+2qSV1Bg==", "requires": { "@babel/runtime-corejs3": "^7.12.5", "cross-fetch": "^3.1.5" diff --git a/package.json b/package.json index e3c6515c..3142ec28 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@reduxjs/toolkit": "^1.8.1", - "@yext/search-core": "^1.9.0-alpha.188", + "@yext/search-core": "^1.9.0-beta.193", "js-levenshtein": "^1.1.6", "lodash": "^4.17.21" }, diff --git a/test-site-node/package-lock.json b/test-site-node/package-lock.json index 96c63d0d..c5814b21 100644 --- a/test-site-node/package-lock.json +++ b/test-site-node/package-lock.json @@ -14,11 +14,11 @@ }, "..": { "name": "@yext/search-headless", - "version": "1.2.0", - "license": "ISC", + "version": "1.3.0", + "license": "BSD-3-Clause", "dependencies": { "@reduxjs/toolkit": "^1.8.1", - "@yext/search-core": "^1.8.0", + "@yext/search-core": "^1.9.0-beta.193", "js-levenshtein": "^1.1.6", "lodash": "^4.17.21" }, @@ -32,11 +32,11 @@ "@types/node": "^16.11.12", "@typescript-eslint/eslint-plugin": "^5.16.0", "@typescript-eslint/parser": "^5.16.0", - "@yext/eslint-config-slapshot": "^0.2.0", + "@yext/eslint-config-slapshot": "^0.4.0", "@yext/eslint-plugin-export-star": "^1.0.0", "babel-jest": "^27.4.5", "eslint": "^8.11.0", - "eslint-config-react-app": "^7.0.0", + "eslint-config-react-app": "^7.0.1", "eslint-plugin-tsdoc": "^0.2.14", "generate-license-file": "^1.3.0", "jest": "^28.1.0", @@ -63,12 +63,12 @@ "@types/node": "^16.11.12", "@typescript-eslint/eslint-plugin": "^5.16.0", "@typescript-eslint/parser": "^5.16.0", - "@yext/search-core": "^1.8.0", - "@yext/eslint-config-slapshot": "^0.2.0", + "@yext/eslint-config-slapshot": "^0.4.0", "@yext/eslint-plugin-export-star": "^1.0.0", + "@yext/search-core": "^1.9.0-beta.193", "babel-jest": "^27.4.5", "eslint": "^8.11.0", - "eslint-config-react-app": "^7.0.0", + "eslint-config-react-app": "^7.0.1", "eslint-plugin-tsdoc": "^0.2.14", "generate-license-file": "^1.3.0", "jest": "^28.1.0", diff --git a/tests/integration/spellcheck.ts b/tests/integration/spellcheck.ts index e8a11a03..58021e98 100644 --- a/tests/integration/spellcheck.ts +++ b/tests/integration/spellcheck.ts @@ -16,7 +16,11 @@ const initialState = { const spellCheckResult = { correctedQuery: 'yext', originalQuery: 'yeet', - type: 'SUGGEST' + type: 'SUGGEST', + matchedSubstrings: [{ + offset: 0, + length: 4 + }] }; function mockSearchWithSpellcheck() { diff --git a/tests/unit/slices/spellcheck.ts b/tests/unit/slices/spellcheck.ts index 9a2b1924..b60d7e50 100644 --- a/tests/unit/slices/spellcheck.ts +++ b/tests/unit/slices/spellcheck.ts @@ -12,7 +12,11 @@ describe('spellCheck slice reducer works as expected', () => { const spellCheck: SpellCheck = { correctedQuery: 'yext', originalQuery: 'yeet', - type: SpellCheckType.Suggest + type: SpellCheckType.Suggest, + matchedSubstrings: [{ + offset: 0, + length: 4 + }] }; const expectedState = { ...initialState, ...spellCheck }; const actualState = reducer({ enabled: true }, setResult(spellCheck)); From 2e993452f245813fb1b192e2275a0067ad0b3b0e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 26 Jul 2022 16:58:26 -0400 Subject: [PATCH 4/6] Update Package Version to v1.4.0 (#127) *An automated PR which updates the version number in package.json and package-lock.json files* --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index ca1b1528..18e5ecbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/search-headless", - "version": "1.4.0-alpha.120", + "version": "1.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/search-headless", - "version": "1.4.0-alpha.120", + "version": "1.4.0", "license": "BSD-3-Clause", "dependencies": { "@reduxjs/toolkit": "^1.8.1", diff --git a/package.json b/package.json index 3142ec28..77174704 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/search-headless", - "version": "1.4.0-alpha.120", + "version": "1.4.0", "description": "A library for powering UI components for Yext Search integrations", "author": "slapshot@yext.com", "license": "BSD-3-Clause", From eccc6aab46cbd2331baef580ac45b88399988d2c Mon Sep 17 00:00:00 2001 From: Alex Taing Date: Wed, 27 Jul 2022 10:35:58 -0400 Subject: [PATCH 5/6] update search core --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 18e5ecbc..8622c460 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "BSD-3-Clause", "dependencies": { "@reduxjs/toolkit": "^1.8.1", - "@yext/search-core": "^1.9.0-beta.193", + "@yext/search-core": "^1.9.0", "js-levenshtein": "^1.1.6", "lodash": "^4.17.21" }, @@ -4686,9 +4686,9 @@ } }, "node_modules/@yext/search-core": { - "version": "1.9.0-beta.193", - "resolved": "https://registry.npmjs.org/@yext/search-core/-/search-core-1.9.0-beta.193.tgz", - "integrity": "sha512-BXS9Zf9EQ30L8dmWPS59kK89l2AEQr1jnAI0vwhSW3rX4o2Y5qs5QxR/pOgTGx3piTfU+u3FJrtELf+2qSV1Bg==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@yext/search-core/-/search-core-1.9.0.tgz", + "integrity": "sha512-HiAF+8D00ZYl3CbC7E6nc4cNWpJgm93WFARHhSzMeN9Ht8XVqdLKkNZN8vCpg2K2jht2IYhCIuJfpW80kDD62w==", "dependencies": { "@babel/runtime-corejs3": "^7.12.5", "cross-fetch": "^3.1.5" @@ -16349,9 +16349,9 @@ } }, "@yext/search-core": { - "version": "1.9.0-beta.193", - "resolved": "https://registry.npmjs.org/@yext/search-core/-/search-core-1.9.0-beta.193.tgz", - "integrity": "sha512-BXS9Zf9EQ30L8dmWPS59kK89l2AEQr1jnAI0vwhSW3rX4o2Y5qs5QxR/pOgTGx3piTfU+u3FJrtELf+2qSV1Bg==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@yext/search-core/-/search-core-1.9.0.tgz", + "integrity": "sha512-HiAF+8D00ZYl3CbC7E6nc4cNWpJgm93WFARHhSzMeN9Ht8XVqdLKkNZN8vCpg2K2jht2IYhCIuJfpW80kDD62w==", "requires": { "@babel/runtime-corejs3": "^7.12.5", "cross-fetch": "^3.1.5" diff --git a/package.json b/package.json index 77174704..691907bf 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@reduxjs/toolkit": "^1.8.1", - "@yext/search-core": "^1.9.0-beta.193", + "@yext/search-core": "^1.9.0", "js-levenshtein": "^1.1.6", "lodash": "^4.17.21" }, From 4ffdc28069df8340c80d8ad59b19267f318e37cf Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 27 Jul 2022 14:36:53 +0000 Subject: [PATCH 6/6] Automated update to THIRD-PARTY-NOTICES from github action's 3rd party notices check --- THIRD-PARTY-NOTICES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/THIRD-PARTY-NOTICES b/THIRD-PARTY-NOTICES index 92ce4c16..9ebe1cc2 100644 --- a/THIRD-PARTY-NOTICES +++ b/THIRD-PARTY-NOTICES @@ -62,7 +62,7 @@ SOFTWARE. The following NPM package may be included in this product: - - @yext/search-core@1.9.0-beta.193 + - @yext/search-core@1.9.0 This package contains the following license and notice below: