Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/instantsearch.js/src/lib/chat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ export { Chat } from './chat';

export const SearchIndexToolType = 'algolia_search_index';
export const RecommendToolType = 'algolia_recommend';
export const MemorizeToolType = 'algolia_memorize';
export const MemorySearchToolType = 'algolia_memory_search';
export const PonderToolType = 'algolia_ponder';
11 changes: 10 additions & 1 deletion packages/instantsearch.js/src/widgets/chat/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ import { useMemo } from 'preact/hooks';

import TemplateComponent from '../../components/Template/Template';
import connectChat from '../../connectors/chat/connectChat';
import { SearchIndexToolType, RecommendToolType } from '../../lib/chat';
import {
SearchIndexToolType,
RecommendToolType,
MemorizeToolType,
MemorySearchToolType,
PonderToolType,
} from '../../lib/chat';
import { prepareTemplateProps } from '../../lib/templating';
import { useStickToBottom } from '../../lib/useStickToBottom';
import {
Expand Down Expand Up @@ -274,6 +280,9 @@ function createDefaultTools<
getSearchPageURL
),
[RecommendToolType]: createCarouselTool(false, templates, getSearchPageURL),
[MemorizeToolType]: { templates: {} },
[MemorySearchToolType]: { templates: {} },
[PonderToolType]: { templates: {} },
};
}

Expand Down
14 changes: 13 additions & 1 deletion packages/react-instantsearch/src/widgets/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { createChatComponent } from 'instantsearch-ui-components';
import {
SearchIndexToolType,
RecommendToolType,
MemorizeToolType,
MemorySearchToolType,
PonderToolType,
} from 'instantsearch.js/es/lib/chat';
import React, { createElement, Fragment } from 'react';
import { useInstantSearch, useChat } from 'react-instantsearch-core';
Expand All @@ -10,7 +13,13 @@ import { useStickToBottom } from '../lib/useStickToBottom';

import { createCarouselTool } from './chat/tools/SearchIndexTool';

export { SearchIndexToolType, RecommendToolType };
export {
SearchIndexToolType,
RecommendToolType,
MemorizeToolType,
MemorySearchToolType,
PonderToolType,
};

import type {
Pragma,
Expand Down Expand Up @@ -45,6 +54,9 @@ export function createDefaultTools<TObject extends RecordWithObjectID>(
itemComponent,
getSearchPageURL
),
[MemorizeToolType]: {},
[MemorySearchToolType]: {},
[PonderToolType]: {},
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const NON_WIDGETS = [
'createDefaultTools',
'SearchIndexToolType',
'RecommendToolType',
'MemorizeToolType',
'MemorySearchToolType',
'PonderToolType',
] as const;
type RegularWidgets = Omit<typeof widgets, typeof NON_WIDGETS[number]>;

Expand All @@ -29,6 +32,9 @@ const NON_COMPONENTS = [
'createDefaultTools',
'SearchIndexToolType',
'RecommendToolType',
'MemorizeToolType',
'MemorySearchToolType',
'PonderToolType',
] as const;
type ComponentWidgets = Omit<typeof widgets, typeof NON_COMPONENTS[number]>;

Expand Down
3 changes: 3 additions & 0 deletions packages/react-instantsearch/src/widgets/index.umd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ https://www.algolia.com/doc/guides/building-search-ui/installation/react/#instal
export * from './FilterSuggestions';
export const SearchIndexToolType = undefined;
export const RecommendToolType = undefined;
export const MemorizeToolType = undefined;
export const MemorySearchToolType = undefined;
export const PonderToolType = undefined;
export const createDefaultTools = () => {};

export * from './ClearRefinements';
Expand Down