@cloudflare/ai-search-snippet 0.0.26 → 0.0.28
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/main.d.ts +11 -14
- package/dist/search-snippet.es.js +189 -120
- package/dist/search-snippet.es.js.map +1 -1
- package/dist/search-snippet.umd.js +98 -40
- package/dist/search-snippet.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export declare class AISearchClient
|
|
1
|
+
export declare class AISearchClient {
|
|
2
|
+
activeRequests: Map<string, RequestState>;
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
constructor(baseUrl: string);
|
|
2
5
|
private request;
|
|
3
6
|
/**
|
|
4
7
|
* Performs a search query with optional streaming
|
|
@@ -159,17 +162,6 @@ declare type ChatTextResponse = {
|
|
|
159
162
|
|
|
160
163
|
declare type ChatTypes = ChatResult | ChatTextResponse | ChatError;
|
|
161
164
|
|
|
162
|
-
declare class Client {
|
|
163
|
-
activeRequests: Map<string, RequestState>;
|
|
164
|
-
baseUrl: string;
|
|
165
|
-
constructor(baseUrl: string);
|
|
166
|
-
search(_query: string, _options?: SearchOptions): Promise<SearchResult[]>;
|
|
167
|
-
searchStream(_query: string, _options?: SearchOptions): AsyncGenerator<SearchResult | SearchError, void, undefined>;
|
|
168
|
-
chat(_message: string, _options?: SearchOptions): AsyncGenerator<ChatTypes, void, undefined>;
|
|
169
|
-
cancelRequest(_requestId: string): void;
|
|
170
|
-
cancelAllRequests(): void;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
165
|
declare interface Message {
|
|
174
166
|
id: string;
|
|
175
167
|
role: 'user' | 'assistant' | 'system';
|
|
@@ -206,7 +198,7 @@ declare class SearchBarSnippet extends HTMLElement {
|
|
|
206
198
|
private handleInputKeydownEnter;
|
|
207
199
|
private handleInputKeydownEscape;
|
|
208
200
|
private handleSearchButtonClick;
|
|
209
|
-
static get observedAttributes(): readonly ["api-url", "placeholder", "max-results", "debounce-ms", "theme", "hide-branding", "show-url", "hide-thumbnails", "see-more"];
|
|
201
|
+
static get observedAttributes(): readonly ["api-url", "placeholder", "max-results", "debounce-ms", "theme", "hide-branding", "show-url", "show-date", "hide-thumbnails", "see-more"];
|
|
210
202
|
constructor();
|
|
211
203
|
connectedCallback(): void;
|
|
212
204
|
disconnectedCallback(): void;
|
|
@@ -226,6 +218,7 @@ declare class SearchBarSnippet extends HTMLElement {
|
|
|
226
218
|
private showEmptyState;
|
|
227
219
|
private showNoResultsState;
|
|
228
220
|
private showErrorState;
|
|
221
|
+
private showMissingApiUrlError;
|
|
229
222
|
private updateTheme;
|
|
230
223
|
private cleanup;
|
|
231
224
|
search(query: string): Promise<void>;
|
|
@@ -262,7 +255,7 @@ export declare class SearchModalSnippet extends HTMLElement {
|
|
|
262
255
|
private handleBackdropClick;
|
|
263
256
|
private savedBodyStyles;
|
|
264
257
|
private savedHtmlOverflow;
|
|
265
|
-
static get observedAttributes(): readonly ["api-url", "placeholder", "max-results", "theme", "shortcut", "use-meta-key", "debounce-ms", "hide-branding", "show-url", "hide-thumbnails", "see-more"];
|
|
258
|
+
static get observedAttributes(): readonly ["api-url", "placeholder", "max-results", "theme", "shortcut", "use-meta-key", "debounce-ms", "hide-branding", "show-url", "show-date", "hide-thumbnails", "see-more"];
|
|
266
259
|
constructor();
|
|
267
260
|
connectedCallback(): void;
|
|
268
261
|
disconnectedCallback(): void;
|
|
@@ -287,6 +280,7 @@ export declare class SearchModalSnippet extends HTMLElement {
|
|
|
287
280
|
private clearLoadingInterval;
|
|
288
281
|
private showNoResultsState;
|
|
289
282
|
private showErrorState;
|
|
283
|
+
private showMissingApiUrlError;
|
|
290
284
|
private updateTheme;
|
|
291
285
|
private lockBodyScroll;
|
|
292
286
|
private unlockBodyScroll;
|
|
@@ -334,6 +328,7 @@ export declare interface SearchResult {
|
|
|
334
328
|
id: string;
|
|
335
329
|
title: string;
|
|
336
330
|
description: string;
|
|
331
|
+
timestamp?: number;
|
|
337
332
|
url?: string;
|
|
338
333
|
image?: string;
|
|
339
334
|
metadata?: Record<string, unknown>;
|
|
@@ -358,6 +353,8 @@ export declare interface SearchSnippetProps {
|
|
|
358
353
|
hideBranding?: boolean;
|
|
359
354
|
/** Show URL in search results (default: false) */
|
|
360
355
|
showUrl?: boolean;
|
|
356
|
+
/** Show date in search results when timestamp is present (default: false) */
|
|
357
|
+
showDate?: boolean;
|
|
361
358
|
/** Hide thumbnails in search results (default: false) */
|
|
362
359
|
hideThumbnails?: boolean;
|
|
363
360
|
/** URL template for "See more" link. The search query is appended URL-encoded. Example: "https://example.com/search?q=" */
|