@docsearch/js 4.1.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.d.ts +51 -6
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/umd/index.js +4 -4
- package/dist/umd/index.js.map +1 -1
- package/package.json +5 -2
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InsightsMethodMap as InsightsMethodMap$1, InsightsClient as InsightsClient$1 } from 'search-insights';
|
|
2
2
|
import React, { JSX } from 'react';
|
|
3
|
+
import { JSX as JSX$1 } from 'preact';
|
|
3
4
|
|
|
4
5
|
type Cache = {
|
|
5
6
|
/**
|
|
@@ -8387,6 +8388,13 @@ type DocSearchTransformClient = {
|
|
|
8387
8388
|
addAlgoliaAgent: LiteClient['addAlgoliaAgent'];
|
|
8388
8389
|
transporter: Pick<LiteClient['transporter'], 'algoliaAgent'>;
|
|
8389
8390
|
};
|
|
8391
|
+
type AskAiSearchParameters = {
|
|
8392
|
+
facetFilters?: string[];
|
|
8393
|
+
filters?: string;
|
|
8394
|
+
attributesToRetrieve?: string[];
|
|
8395
|
+
restrictSearchableAttributes?: string[];
|
|
8396
|
+
distinct?: boolean;
|
|
8397
|
+
};
|
|
8390
8398
|
type DocSearchAskAi = {
|
|
8391
8399
|
/**
|
|
8392
8400
|
* The index name to use for the ask AI feature. Your assistant will search this index for relevant documents.
|
|
@@ -8410,9 +8418,13 @@ type DocSearchAskAi = {
|
|
|
8410
8418
|
/**
|
|
8411
8419
|
* The search parameters to use for the ask AI feature.
|
|
8412
8420
|
*/
|
|
8413
|
-
searchParameters?:
|
|
8414
|
-
|
|
8415
|
-
|
|
8421
|
+
searchParameters?: AskAiSearchParameters;
|
|
8422
|
+
/**
|
|
8423
|
+
* Enables displaying suggested questions on Ask AI's new conversation screen.
|
|
8424
|
+
*
|
|
8425
|
+
* @default false
|
|
8426
|
+
*/
|
|
8427
|
+
suggestedQuestions?: boolean;
|
|
8416
8428
|
};
|
|
8417
8429
|
interface DocSearchIndex {
|
|
8418
8430
|
name: string;
|
|
@@ -8467,16 +8479,28 @@ interface DocSearchProps$1 {
|
|
|
8467
8479
|
transformItems?: (items: DocSearchHit[]) => DocSearchHit[];
|
|
8468
8480
|
/**
|
|
8469
8481
|
* Custom component to render an individual hit.
|
|
8482
|
+
* Supports template patterns:
|
|
8483
|
+
* - HTML strings with html helper: (props, { html }) => html`<div>...</div>`
|
|
8484
|
+
* - JSX templates: (props) => <div>...</div>
|
|
8485
|
+
* - Function-based templates: (props) => string | JSX.Element | Function.
|
|
8470
8486
|
*/
|
|
8471
8487
|
hitComponent?: (props: {
|
|
8472
8488
|
hit: InternalDocSearchHit | StoredDocSearchHit;
|
|
8473
8489
|
children: React.ReactNode;
|
|
8490
|
+
}, helpers?: {
|
|
8491
|
+
html: (template: TemplateStringsArray, ...values: any[]) => any;
|
|
8474
8492
|
}) => JSX.Element;
|
|
8475
8493
|
/**
|
|
8476
8494
|
* Custom component rendered at the bottom of the results panel.
|
|
8495
|
+
* Supports template patterns:
|
|
8496
|
+
* - HTML strings with html helper: (props, { html }) => html`<div>...</div>`
|
|
8497
|
+
* - JSX templates: (props) => <div>...</div>
|
|
8498
|
+
* - Function-based templates: (props) => string | JSX.Element | Function.
|
|
8477
8499
|
*/
|
|
8478
8500
|
resultsFooterComponent?: (props: {
|
|
8479
8501
|
state: AutocompleteState$1<InternalDocSearchHit>;
|
|
8502
|
+
}, helpers?: {
|
|
8503
|
+
html: (template: TemplateStringsArray, ...values: any[]) => any;
|
|
8480
8504
|
}) => JSX.Element | null;
|
|
8481
8505
|
/**
|
|
8482
8506
|
* Hook to wrap or modify the algolia search client.
|
|
@@ -8548,6 +8572,11 @@ type FooterTranslations = Partial<{
|
|
|
8548
8572
|
poweredByText: string;
|
|
8549
8573
|
}>;
|
|
8550
8574
|
|
|
8575
|
+
type NewConversationTranslations = Partial<{
|
|
8576
|
+
newConversationTitle: string;
|
|
8577
|
+
newConversationDescription: string;
|
|
8578
|
+
}>;
|
|
8579
|
+
|
|
8551
8580
|
type AskAiScreenTranslations = Partial<{
|
|
8552
8581
|
disclaimerText: string;
|
|
8553
8582
|
relatedSourcesText: string;
|
|
@@ -8577,6 +8606,10 @@ type AskAiScreenTranslations = Partial<{
|
|
|
8577
8606
|
lastSeparator?: string;
|
|
8578
8607
|
after?: string;
|
|
8579
8608
|
};
|
|
8609
|
+
/**
|
|
8610
|
+
* Message that's shown when user has stopped the streaming of a message.
|
|
8611
|
+
*/
|
|
8612
|
+
stoppedStreamingText: string;
|
|
8580
8613
|
}>;
|
|
8581
8614
|
|
|
8582
8615
|
type ErrorScreenTranslations = Partial<{
|
|
@@ -8593,6 +8626,7 @@ type NoResultsScreenTranslations = Partial<{
|
|
|
8593
8626
|
|
|
8594
8627
|
type ResultsScreenTranslations = Partial<{
|
|
8595
8628
|
askAiPlaceholder: string;
|
|
8629
|
+
noResultsAskAiPlaceholder: string;
|
|
8596
8630
|
}>;
|
|
8597
8631
|
|
|
8598
8632
|
type StartScreenTranslations = Partial<{
|
|
@@ -8612,6 +8646,7 @@ type ScreenStateTranslations = Partial<{
|
|
|
8612
8646
|
noResultsScreen: NoResultsScreenTranslations;
|
|
8613
8647
|
resultsScreen: ResultsScreenTranslations;
|
|
8614
8648
|
askAiScreen: AskAiScreenTranslations;
|
|
8649
|
+
newConversation: NewConversationTranslations;
|
|
8615
8650
|
}>;
|
|
8616
8651
|
|
|
8617
8652
|
type SearchBoxTranslations = Partial<{
|
|
@@ -8627,17 +8662,27 @@ type SearchBoxTranslations = Partial<{
|
|
|
8627
8662
|
searchInputLabel: string;
|
|
8628
8663
|
backToKeywordSearchButtonText: string;
|
|
8629
8664
|
backToKeywordSearchButtonAriaLabel: string;
|
|
8665
|
+
newConversationPlaceholder: string;
|
|
8666
|
+
conversationHistoryTitle: string;
|
|
8667
|
+
startNewConversationText: string;
|
|
8668
|
+
viewConversationHistoryText: string;
|
|
8630
8669
|
}>;
|
|
8631
8670
|
|
|
8632
8671
|
type ModalTranslations = Partial<{
|
|
8633
8672
|
searchBox: SearchBoxTranslations;
|
|
8673
|
+
newConversation: NewConversationTranslations;
|
|
8634
8674
|
footer: FooterTranslations;
|
|
8635
8675
|
}> & ScreenStateTranslations;
|
|
8636
8676
|
|
|
8637
|
-
|
|
8677
|
+
type DocSearchProps = DocSearchProps$1 & {
|
|
8638
8678
|
container: HTMLElement | string;
|
|
8639
8679
|
environment?: typeof window;
|
|
8640
|
-
}
|
|
8641
|
-
declare
|
|
8680
|
+
};
|
|
8681
|
+
declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => JSX$1.Element;
|
|
8682
|
+
type TemplateHelpers = Record<string, unknown> & {
|
|
8683
|
+
html: typeof html;
|
|
8684
|
+
};
|
|
8685
|
+
declare function docsearch(allProps: DocSearchProps): () => void;
|
|
8642
8686
|
|
|
8643
8687
|
export { docsearch as default };
|
|
8688
|
+
export type { DocSearchProps, TemplateHelpers };
|