Skip to content

Commit

Permalink
Merge cbbcbb1 into 233b24f
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannzhou committed Aug 18, 2022
2 parents 233b24f + cbbcbb1 commit c06a1fc
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 137 deletions.
4 changes: 2 additions & 2 deletions THIRD-PARTY-NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ SOFTWARE.

The following NPM package may be included in this product:

- @yext/search-core@1.9.0
- @yext/search-core@2.0.0-alpha.215

This package contains the following license and notice below:

Expand Down Expand Up @@ -106,7 +106,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@1.4.0
- @yext/search-headless@2.0.0-alpha.133

This package contains the following license and notice below:

Expand Down
34 changes: 17 additions & 17 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yext/search-headless-react",
"version": "1.4.0",
"version": "2.0.0-alpha.152",
"description": "The official React UI Bindings layer for Search Headless",
"main": "./lib/esm/src/index.js",
"license": "BSD-3-Clause",
Expand Down Expand Up @@ -32,7 +32,7 @@
"generate-notices": "generate-license-file --input package.json --output THIRD-PARTY-NOTICES --overwrite"
},
"dependencies": {
"@yext/search-headless": "^1.4.0",
"@yext/search-headless": "2.0.0-alpha.134",
"use-sync-external-store": "^1.1.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/SearchHeadlessProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ type Props = HeadlessConfig & {
};

export function SearchHeadlessProvider(props: PropsWithChildren<Props>): JSX.Element {
const { children, verticalKey, sessionTrackingEnabled=true, ...answersConfig } = props;
const { children, verticalKey, sessionTrackingEnabled=true, ...searchConfig } = props;
const additionalHttpHeaders = {
'Client-SDK': {
ANSWERS_HEADLESS_REACT: version
}
};
const answers: SearchHeadless = provideHeadless(answersConfig, additionalHttpHeaders);
const answers: SearchHeadless = provideHeadless(searchConfig, additionalHttpHeaders);

verticalKey && answers.setVertical(verticalKey);
answers.setSessionTrackingEnabled(sessionTrackingEnabled);
Expand Down
51 changes: 0 additions & 51 deletions src/deprecated.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { useSearchActions, SearchActions } from './useSearchActions';
import { useSearchState, StateSelector } from './useSearchState';
import { useSearchUtilities, SearchUtilities } from './useSearchUtilities';
import { subscribeToStateUpdates } from './subscribeToStateUpdates';
import { SearchHeadlessProvider } from './SearchHeadlessProvider';
import { SearchHeadlessContext } from './SearchHeadlessContext';

export * from '@yext/search-headless';
export * from './deprecated';
export {
SearchHeadlessContext,
subscribeToStateUpdates,
useSearchActions,
useSearchState,
useSearchUtilities,
Expand Down
52 changes: 0 additions & 52 deletions src/subscribeToStateUpdates.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions tests/setup/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { universalQueryResponse, universalQueryResponseWithFilters } from './res

// Any unhandled requests are dropped and logged as warnings
const handlers = [
rest.get(/answers\/vertical\/query/, (req, res, ctx) => {
rest.get(/search\/vertical\/query/, (req, res, ctx) => {
const input = req.url.searchParams.get('input');
switch (input) {
case 'resultsWithNlpFilter':
Expand All @@ -18,7 +18,7 @@ const handlers = [
);
}
}),
rest.get(/answers\/query/, (req, res, ctx) => {
rest.get(/search\/query/, (req, res, ctx) => {
const input = req.url.searchParams.get('input');
switch (input) {
case 'resultsWithFilter':
Expand Down
12 changes: 6 additions & 6 deletions tests/useSearchState.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ it('invoke useSearchState outside of SearchHeadlessProvider', () => {
});

it('Retrieves state snapshot during server side rendering and hydration process', () => {
const answers = createAnswersHeadless();
const answers = createSearchHeadless();
const mockedOnClick= jest.fn().mockImplementation(() => {
answers.setVertical('anotherFakeKey');
});
Expand Down Expand Up @@ -86,7 +86,7 @@ it('does not perform extra renders/listener registrations for nested components'
);
}

const answers = createAnswersHeadless();
const answers = createSearchHeadless();
const addListenerSpy = jest.spyOn(answers, 'addListener');
expect(addListenerSpy).toHaveBeenCalledTimes(0);
expect(parentStateUpdates).toHaveLength(0);
Expand Down Expand Up @@ -129,7 +129,7 @@ it('does not trigger render on unmounted component', async () => {
return <div>child component</div>;
}

const answers = createAnswersHeadless();
const answers = createSearchHeadless();
render(
<SearchHeadlessContext.Provider value={answers}>
<ParentComponent/>
Expand Down Expand Up @@ -161,7 +161,7 @@ describe('uses the most recent selector', () => {
);
}

const answers = createAnswersHeadless();
const answers = createSearchHeadless();
render(
<SearchHeadlessContext.Provider value={answers}>
<Test />
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('uses the most recent selector', () => {
);
}

const answers = createAnswersHeadless();
const answers = createSearchHeadless();
answers.setQuery('initial value');
expect(stateUpdates).toHaveLength(0);
render(
Expand All @@ -219,7 +219,7 @@ describe('uses the most recent selector', () => {
});
});

function createAnswersHeadless() {
function createSearchHeadless() {
return provideHeadless({
apiKey: 'fake api key',
experienceKey: 'fake exp key',
Expand Down

0 comments on commit c06a1fc

Please sign in to comment.