@pixygon/chatbot-react 0.1.0 → 0.1.1
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/index.d.ts +14 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { Api
|
|
2
|
+
import { Api } from '@reduxjs/toolkit/query';
|
|
3
3
|
|
|
4
|
+
/** RTK Query Api generics are invariant — a host's concrete baseApi
|
|
5
|
+
* (with literal `reducerPath` and specific tag types) cannot fit into a
|
|
6
|
+
* narrower-looking `Api<BFn, {}, string, string>`. We therefore accept
|
|
7
|
+
* any concrete Api shape and rely on injectChatbotEndpoints to do the
|
|
8
|
+
* runtime work. The host's hooks (returned by createChatbotComponents)
|
|
9
|
+
* remain fully typed inside the package; the host doesn't need a cast. */
|
|
10
|
+
type AnyApi$1 = Api<any, any, any, any>;
|
|
4
11
|
interface ChatbotBrand {
|
|
5
12
|
/** Display name shown in the embed header, system prompt, etc. */
|
|
6
13
|
name: string;
|
|
@@ -11,7 +18,7 @@ interface ChatbotBrand {
|
|
|
11
18
|
}
|
|
12
19
|
interface ChatbotComponentConfig {
|
|
13
20
|
/** The host's RTK Query baseApi. Endpoints get injected onto it. */
|
|
14
|
-
apiSlice:
|
|
21
|
+
apiSlice: AnyApi$1;
|
|
15
22
|
/** Path prefix the server router was mounted under. */
|
|
16
23
|
pathPrefix: string;
|
|
17
24
|
/** Hook the host implements to surface the active tenant id. */
|
|
@@ -32,6 +39,10 @@ interface TenantWithCap {
|
|
|
32
39
|
chatCostCapUsdMonthly?: number | null;
|
|
33
40
|
}
|
|
34
41
|
|
|
42
|
+
/** See `context.ts` — RTK Query's Api generics are invariant, so we accept
|
|
43
|
+
* the host's concrete Api shape via `any` parameters. The runtime cast
|
|
44
|
+
* inside the function preserves all internal logic. */
|
|
45
|
+
type AnyApi = Api<any, any, any, any>;
|
|
35
46
|
interface KnowledgeDocument {
|
|
36
47
|
_id: string;
|
|
37
48
|
tenantId?: string;
|
|
@@ -166,7 +177,7 @@ interface SemanticCluster {
|
|
|
166
177
|
* The host should add "Knowledge" + "ChatConversation" to baseApi's
|
|
167
178
|
* tagTypes when constructing it.
|
|
168
179
|
*/
|
|
169
|
-
declare function injectChatbotEndpoints(baseApi:
|
|
180
|
+
declare function injectChatbotEndpoints(baseApi: AnyApi, opts?: {
|
|
170
181
|
pathPrefix: string;
|
|
171
182
|
}): any;
|
|
172
183
|
type ChatbotHooks = ReturnType<typeof injectChatbotEndpoints>;
|
package/package.json
CHANGED