Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@docsearch/react

Package Overview
Dependencies
Maintainers
4
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@docsearch/react - npm Package Compare versions

Comparing version
3.9.0
to
4.0.0-beta.0
+99
-11
dist/esm/index.d.ts
import { BaseItem, AutocompleteState, AutocompleteContext, AutocompleteInsightsApi, AutocompleteOptions } from '@algolia/autocomplete-core';
import { LiteClient, SearchParamsObject } from 'algoliasearch/lite';
import React, { JSX } from 'react';
import { Message } from '@ai-sdk/react';
type ContentType = 'content' | 'lvl0' | 'lvl1' | 'lvl2' | 'lvl3' | 'lvl4' | 'lvl5' | 'lvl6';
type ContentType = 'askAI' | 'content' | 'lvl0' | 'lvl1' | 'lvl2' | 'lvl3' | 'lvl4' | 'lvl5' | 'lvl6';
interface DocSearchHitAttributeHighlightResult {

@@ -38,2 +39,3 @@ value: string;

content: string | null;
query?: string;
url: string;

@@ -90,2 +92,4 @@ url_without_anchor: string;

type DocSearchTheme = 'dark' | 'light';
type InternalDocSearchHit = DocSearchHit & {

@@ -96,2 +100,9 @@ __docsearch_parent: InternalDocSearchHit | null;

type StoredDocSearchHit = Omit<DocSearchHit, '_highlightResult' | '_snippetResult'>;
type StoredAskAiMessage = Message & {
/** Optional user feedback on this assistant message. */
feedback?: 'dislike' | 'like';
};
type StoredAskAiState = Omit<DocSearchHit, '_highlightResult' | '_snippetResult'> & {
messages?: StoredAskAiMessage[];
};

@@ -107,2 +118,23 @@ type DocSearchTranslations = Partial<{

};
type DocSearchAskAi = {
/**
* The index name to use for the ask AI feature. Your assistant will search this index for relevant documents.
* If not provided, the index name will be used.
*/
indexName?: string;
/**
* The API key to use for the ask AI feature. Your assistant will use this API key to search the index.
* If not provided, the API key will be used.
*/
apiKey?: string;
/**
* The app ID to use for the ask AI feature. Your assistant will use this app ID to search the index.
* If not provided, the app ID will be used.
*/
appId?: string;
/**
* The assistant ID to use for the ask AI feature.
*/
assistantId: string | null;
};
interface DocSearchProps {

@@ -112,2 +144,4 @@ appId: string;

indexName: string;
askAi?: DocSearchAskAi | string;
theme?: DocSearchTheme;
placeholder?: string;

@@ -134,3 +168,3 @@ searchParameters?: SearchParamsObject;

}
declare function DocSearch(props: DocSearchProps): JSX.Element;
declare function DocSearch({ ...props }: DocSearchProps): JSX.Element;

@@ -142,2 +176,3 @@ type ButtonTranslations = Partial<{

type DocSearchButtonProps = React.ComponentProps<'button'> & {
theme?: DocSearchTheme;
translations?: ButtonTranslations;

@@ -149,2 +184,3 @@ };

selectText: string;
submitQuestionText: string;
selectKeyAriaLabel: string;

@@ -155,6 +191,38 @@ navigateText: string;

closeText: string;
backToSearchText: string;
closeKeyAriaLabel: string;
searchByText: string;
poweredByText: string;
}>;
type AskAiScreenTranslations = Partial<{
disclaimerText: string;
relatedSourcesText: string;
thinkingText: string;
copyButtonText: string;
copyButtonCopiedText: string;
copyButtonTitle: string;
likeButtonTitle: string;
dislikeButtonTitle: string;
thanksForFeedbackText: string;
preToolCallText: string;
duringToolCallText: string;
afterToolCallText: string;
/**
* Build the full jsx element for the aggregated search block.
* If provided, completely overrides the default english renderer.
*/
aggregatedToolCallNode?: (queries: string[], onSearchQueryClick: (query: string) => void) => React.ReactNode;
/**
* Generate the list connective parts only (backwards compatibility).
* Receives full list of queries and should return translation parts for before/after/separators.
* Example: (qs) => ({ before: 'searched for ', separator: ', ', lastSeparator: ' and ', after: '' }).
*/
aggregatedToolCallText?: (queries: string[]) => {
before?: string;
separator?: string;
lastSeparator?: string;
after?: string;
};
}>;
type ErrorScreenTranslations = Partial<{

@@ -172,2 +240,6 @@ titleText: string;

type ResultsScreenTranslations = Partial<{
askAiPlaceholder: string;
}>;
type StartScreenTranslations = Partial<{

@@ -180,2 +252,4 @@ recentSearchesTitle: string;

removeFavoriteSearchButtonTitle: string;
recentConversationsTitle: string;
removeRecentConversationButtonTitle: string;
}>;

@@ -187,10 +261,19 @@

noResultsScreen: NoResultsScreenTranslations;
resultsScreen: ResultsScreenTranslations;
askAiScreen: AskAiScreenTranslations;
}>;
type SearchBoxTranslations = Partial<{
resetButtonTitle: string;
resetButtonAriaLabel: string;
cancelButtonText: string;
cancelButtonAriaLabel: string;
clearButtonTitle: string;
clearButtonAriaLabel: string;
closeButtonText: string;
closeButtonAriaLabel: string;
placeholderText: string;
placeholderTextAskAi: string;
placeholderTextAskAiStreaming: string;
enterKeyHint: string;
enterKeyHintAskAi: string;
searchInputLabel: string;
backToKeywordSearchButtonText: string;
backToKeywordSearchButtonAriaLabel: string;
}>;

@@ -204,6 +287,9 @@

initialScrollY: number;
onAskAiToggle: (toggle: boolean) => void;
onClose?: () => void;
isAskAiActive?: boolean;
canHandleAskAi?: boolean;
translations?: ModalTranslations;
};
declare function DocSearchModal({ appId, apiKey, indexName, placeholder, searchParameters, maxResultsPerGroup, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, }: DocSearchModalProps): JSX.Element;
declare function DocSearchModal({ appId, apiKey, indexName, placeholder, askAi, searchParameters, maxResultsPerGroup, theme, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, onAskAiToggle, isAskAiActive, canHandleAskAi, }: DocSearchModalProps): JSX.Element;

@@ -216,7 +302,9 @@ interface UseDocSearchKeyboardEventsProps {

searchButtonRef: React.RefObject<HTMLButtonElement | null>;
isAskAiActive: boolean;
onAskAiToggle: (toggle: boolean) => void;
}
declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, onInput, searchButtonRef, }: UseDocSearchKeyboardEventsProps): void;
declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, onInput, isAskAiActive, onAskAiToggle, searchButtonRef, }: UseDocSearchKeyboardEventsProps): void;
declare const version = "3.9.0";
declare const version = "4.0.0-beta.0";
export { type ButtonTranslations, DocSearch, DocSearchButton, type DocSearchButtonProps, type DocSearchHit, DocSearchModal, type DocSearchModalProps, type DocSearchProps, type DocSearchState, type DocSearchTransformClient, type DocSearchTranslations, type InternalDocSearchHit, type ModalTranslations, type StoredDocSearchHit, type UseDocSearchKeyboardEventsProps, useDocSearchKeyboardEvents, version };
export { type ButtonTranslations, DocSearch, type DocSearchAskAi, DocSearchButton, type DocSearchButtonProps, type DocSearchHit, DocSearchModal, type DocSearchModalProps, type DocSearchProps, type DocSearchState, type DocSearchTheme, type DocSearchTransformClient, type DocSearchTranslations, type InternalDocSearchHit, type ModalTranslations, type StoredAskAiMessage, type StoredAskAiState, type StoredDocSearchHit, type UseDocSearchKeyboardEventsProps, useDocSearchKeyboardEvents, version };
+11
-7
{
"name": "@docsearch/react",
"description": "React package for DocSearch, the best search experience for docs.",
"version": "3.9.0",
"version": "4.0.0-beta.0",
"license": "MIT",

@@ -36,9 +36,11 @@ "homepage": "https://docsearch.algolia.com",

"on:change": "yarn build",
"watch": "watch \"yarn on:change\" --ignoreDirectoryPattern \"/dist/\""
"watch": "nodemon --watch src --ext ts,tsx,js,jsx,json --ignore dist/ --ignore node_modules/ --verbose --delay 250ms --exec \"yarn on:change\""
},
"dependencies": {
"@algolia/autocomplete-core": "1.17.9",
"@algolia/autocomplete-preset-algolia": "1.17.9",
"@docsearch/css": "3.9.0",
"algoliasearch": "^5.14.2"
"@ai-sdk/react": "^1.2.12",
"@algolia/autocomplete-core": "1.19.2",
"@algolia/autocomplete-preset-algolia": "1.19.2",
"@docsearch/css": "4.0.0-beta.0",
"algoliasearch": "^5.28.0",
"marked": "^15.0.12"
},

@@ -49,3 +51,5 @@ "devDependencies": {

"@testing-library/react": "16.2.0",
"vitest": "3.0.2"
"nodemon": "^3.1.0",
"vitest": "3.0.2",
"zod": "^3.25.67"
},

@@ -52,0 +56,0 @@ "peerDependencies": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display