@yak-io/react 0.1.1 → 0.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/YakProvider.d.ts.map +1 -1
- package/dist/YakProvider.js +33 -1
- package/dist/context.d.ts +39 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +48 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/logger.d.ts +3 -9
- package/dist/internal/logger.d.ts.map +1 -1
- package/dist/internal/logger.js +3 -42
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YakProvider.d.ts","sourceRoot":"","sources":["../src/YakProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,EAEL,KAAK,KAAK,EAGV,KAAK,kBAAkB,EACvB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"YakProvider.d.ts","sourceRoot":"","sources":["../src/YakProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,EAEL,KAAK,KAAK,EAGV,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAEpB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAG5B;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B;;;;;;;;;;;;;;;OAeG;IACH,mBAAmB,CAAC,EAAE,oBAAoB,CAAC;IAC3C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IACrC,mCAAmC;IACnC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,qEAAqE;IACrE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,uDAAuD;IACvD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,0BAA0B;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,EACL,UAAU,EACV,oBAAoB,EACpB,QAAQ,GACT,EAAE,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAmOtC"}
|
package/dist/YakProvider.js
CHANGED
|
@@ -13,6 +13,24 @@ export function YakProvider({ appId, getConfig, onToolCall, onGraphQLSchemaCall,
|
|
|
13
13
|
const [isWidgetOpen, setIsWidgetOpen] = useState(false);
|
|
14
14
|
const [pendingPrompt, setPendingPrompt] = useState(null);
|
|
15
15
|
const [isIframeReady, setIsIframeReady] = useState(false);
|
|
16
|
+
// Store event subscribers for tool call events
|
|
17
|
+
const toolEventSubscribersRef = useRef(new Set());
|
|
18
|
+
// Handler that notifies all subscribers when a tool call completes
|
|
19
|
+
const handleToolCallComplete = useCallback((event) => {
|
|
20
|
+
logger.debug("Tool call completed, notifying subscribers:", {
|
|
21
|
+
name: event.name,
|
|
22
|
+
ok: event.ok,
|
|
23
|
+
subscriberCount: toolEventSubscribersRef.current.size,
|
|
24
|
+
});
|
|
25
|
+
for (const handler of toolEventSubscribersRef.current) {
|
|
26
|
+
try {
|
|
27
|
+
handler(event);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
logger.warn("Error in tool event subscriber:", err);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, []);
|
|
16
34
|
// Initialize YakClient
|
|
17
35
|
const clientRef = useRef(null);
|
|
18
36
|
if (!clientRef.current) {
|
|
@@ -26,6 +44,7 @@ export function YakProvider({ appId, getConfig, onToolCall, onGraphQLSchemaCall,
|
|
|
26
44
|
options: { disableRestartButton },
|
|
27
45
|
onClose: () => setIsWidgetOpen(false),
|
|
28
46
|
onReady: () => setIsIframeReady(true),
|
|
47
|
+
onToolCallComplete: handleToolCallComplete,
|
|
29
48
|
});
|
|
30
49
|
}
|
|
31
50
|
const client = clientRef.current;
|
|
@@ -42,8 +61,9 @@ export function YakProvider({ appId, getConfig, onToolCall, onGraphQLSchemaCall,
|
|
|
42
61
|
onRedirect,
|
|
43
62
|
options: { disableRestartButton },
|
|
44
63
|
chatConfig: chatConfig ?? undefined,
|
|
64
|
+
onToolCallComplete: handleToolCallComplete,
|
|
45
65
|
});
|
|
46
|
-
}, [appId, onToolCall, onGraphQLSchemaCall, onRESTSchemaCall, theme, onRedirect, disableRestartButton, chatConfig, client]);
|
|
66
|
+
}, [appId, onToolCall, onGraphQLSchemaCall, onRESTSchemaCall, theme, onRedirect, disableRestartButton, chatConfig, client, handleToolCallComplete]);
|
|
47
67
|
// Update client iframe window
|
|
48
68
|
useEffect(() => {
|
|
49
69
|
client.setIframeWindow(iframeWindow);
|
|
@@ -141,6 +161,16 @@ export function YakProvider({ appId, getConfig, onToolCall, onGraphQLSchemaCall,
|
|
|
141
161
|
iframeWindow.postMessage(focusMessage, iframeOrigin);
|
|
142
162
|
}
|
|
143
163
|
}, [isWidgetOpen, iframeWindow, isIframeReady, iframeOrigin]);
|
|
164
|
+
// Subscribe to tool call completion events
|
|
165
|
+
const subscribeToToolEvents = useCallback((handler) => {
|
|
166
|
+
toolEventSubscribersRef.current.add(handler);
|
|
167
|
+
logger.debug("Tool event subscriber added, total:", toolEventSubscribersRef.current.size);
|
|
168
|
+
// Return unsubscribe function
|
|
169
|
+
return () => {
|
|
170
|
+
toolEventSubscribersRef.current.delete(handler);
|
|
171
|
+
logger.debug("Tool event subscriber removed, total:", toolEventSubscribersRef.current.size);
|
|
172
|
+
};
|
|
173
|
+
}, []);
|
|
144
174
|
const contextValue = useMemo(() => ({
|
|
145
175
|
config,
|
|
146
176
|
getIframeOrigin,
|
|
@@ -154,6 +184,7 @@ export function YakProvider({ appId, getConfig, onToolCall, onGraphQLSchemaCall,
|
|
|
154
184
|
close,
|
|
155
185
|
openWithPrompt,
|
|
156
186
|
setIsIframeReady,
|
|
187
|
+
subscribeToToolEvents,
|
|
157
188
|
}), [
|
|
158
189
|
config,
|
|
159
190
|
getIframeOrigin,
|
|
@@ -166,6 +197,7 @@ export function YakProvider({ appId, getConfig, onToolCall, onGraphQLSchemaCall,
|
|
|
166
197
|
open,
|
|
167
198
|
close,
|
|
168
199
|
openWithPrompt,
|
|
200
|
+
subscribeToToolEvents,
|
|
169
201
|
]);
|
|
170
202
|
return _jsx(YakContext.Provider, { value: contextValue, children: children });
|
|
171
203
|
}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Theme, IframeMessageFromHost, ChatConfig } from "@yak-io/javascript";
|
|
1
|
+
import type { Theme, IframeMessageFromHost, ChatConfig, ToolCallEvent } from "@yak-io/javascript";
|
|
2
2
|
/**
|
|
3
3
|
* Configuration for the yak provider
|
|
4
4
|
*/
|
|
@@ -8,6 +8,10 @@ export type YakConfig = {
|
|
|
8
8
|
chatConfig?: ChatConfig | null;
|
|
9
9
|
onRedirect?: (path: string) => void;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Listener function for tool call events
|
|
13
|
+
*/
|
|
14
|
+
export type ToolCallEventHandler = (event: ToolCallEvent) => void;
|
|
11
15
|
/**
|
|
12
16
|
* Context value with config and iframe management
|
|
13
17
|
*/
|
|
@@ -31,6 +35,8 @@ export type YakContextValue = {
|
|
|
31
35
|
/** Open the chat widget and trigger a specific prompt */
|
|
32
36
|
openWithPrompt: (prompt: string) => void;
|
|
33
37
|
setIsIframeReady: (ready: boolean) => void;
|
|
38
|
+
/** Subscribe to tool call completion events */
|
|
39
|
+
subscribeToToolEvents: (handler: ToolCallEventHandler) => () => void;
|
|
34
40
|
};
|
|
35
41
|
export declare const YakContext: import("react").Context<YakContextValue | null>;
|
|
36
42
|
/**
|
|
@@ -54,4 +60,36 @@ export declare const YakContext: import("react").Context<YakContextValue | null>
|
|
|
54
60
|
* @throws {Error} if used outside YakProvider
|
|
55
61
|
*/
|
|
56
62
|
export declare function useYak(): YakContextValue;
|
|
63
|
+
/**
|
|
64
|
+
* Hook to subscribe to tool call completion events.
|
|
65
|
+
* Useful for page-level cache invalidation when chatbot tools modify data.
|
|
66
|
+
*
|
|
67
|
+
* The handler receives an event with:
|
|
68
|
+
* - `name`: The tool name that was called (e.g., "order.cancel")
|
|
69
|
+
* - `args`: The arguments passed to the tool
|
|
70
|
+
* - `ok`: Whether the call succeeded
|
|
71
|
+
* - `result`: The result (if ok is true)
|
|
72
|
+
* - `error`: The error message (if ok is false)
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* function PlanPage({ planId }: { planId: string }) {
|
|
77
|
+
* const utils = trpc.useUtils();
|
|
78
|
+
*
|
|
79
|
+
* useYakToolEvent((event) => {
|
|
80
|
+
* // Only invalidate if this tool touched plans
|
|
81
|
+
* if (event.ok && event.name.startsWith("plan.")) {
|
|
82
|
+
* utils.plan.get.invalidate({ id: planId });
|
|
83
|
+
* utils.planItem.list.invalidate({ planId });
|
|
84
|
+
* }
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* // ... rest of component
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @param handler - Function called after each tool call completes
|
|
92
|
+
* @throws {Error} if used outside YakProvider
|
|
93
|
+
*/
|
|
94
|
+
export declare function useYakToolEvent(handler: ToolCallEventHandler): void;
|
|
57
95
|
//# sourceMappingURL=context.d.ts.map
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAElG;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,SAAS,CAAC;IAClB,4DAA4D;IAC5D,eAAe,EAAE,MAAM,MAAM,CAAC;IAC9B,oCAAoC;IACpC,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,oBAAoB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,sBAAsB,EAAE,MAAM,IAAI,CAAC;IACnC,WAAW,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACtD,gDAAgD;IAChD,MAAM,EAAE,OAAO,CAAC;IAChB,sDAAsD;IACtD,aAAa,EAAE,OAAO,CAAC;IACvB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,yDAAyD;IACzD,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,+CAA+C;IAC/C,qBAAqB,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,MAAM,IAAI,CAAC;CACtE,CAAC;AAEF,eAAO,MAAM,UAAU,iDAA8C,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,IAAI,eAAe,CAMxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAkBnE"}
|
package/dist/context.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
2
|
+
import { createContext, useContext, useEffect, useRef } from "react";
|
|
3
3
|
export const YakContext = createContext(null);
|
|
4
4
|
/**
|
|
5
5
|
* Hook to access the Yak chat widget API.
|
|
@@ -28,3 +28,50 @@ export function useYak() {
|
|
|
28
28
|
}
|
|
29
29
|
return context;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Hook to subscribe to tool call completion events.
|
|
33
|
+
* Useful for page-level cache invalidation when chatbot tools modify data.
|
|
34
|
+
*
|
|
35
|
+
* The handler receives an event with:
|
|
36
|
+
* - `name`: The tool name that was called (e.g., "order.cancel")
|
|
37
|
+
* - `args`: The arguments passed to the tool
|
|
38
|
+
* - `ok`: Whether the call succeeded
|
|
39
|
+
* - `result`: The result (if ok is true)
|
|
40
|
+
* - `error`: The error message (if ok is false)
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* function PlanPage({ planId }: { planId: string }) {
|
|
45
|
+
* const utils = trpc.useUtils();
|
|
46
|
+
*
|
|
47
|
+
* useYakToolEvent((event) => {
|
|
48
|
+
* // Only invalidate if this tool touched plans
|
|
49
|
+
* if (event.ok && event.name.startsWith("plan.")) {
|
|
50
|
+
* utils.plan.get.invalidate({ id: planId });
|
|
51
|
+
* utils.planItem.list.invalidate({ planId });
|
|
52
|
+
* }
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // ... rest of component
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @param handler - Function called after each tool call completes
|
|
60
|
+
* @throws {Error} if used outside YakProvider
|
|
61
|
+
*/
|
|
62
|
+
export function useYakToolEvent(handler) {
|
|
63
|
+
const context = useContext(YakContext);
|
|
64
|
+
if (!context) {
|
|
65
|
+
throw new Error("useYakToolEvent must be used within YakProvider");
|
|
66
|
+
}
|
|
67
|
+
// Use ref to always have latest handler without re-subscribing
|
|
68
|
+
const handlerRef = useRef(handler);
|
|
69
|
+
handlerRef.current = handler;
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
// Wrap handler to use ref (stable reference)
|
|
72
|
+
const stableHandler = (event) => {
|
|
73
|
+
handlerRef.current(event);
|
|
74
|
+
};
|
|
75
|
+
return context.subscribeToToolEvents(stableHandler);
|
|
76
|
+
}, [context]);
|
|
77
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { useYak } from "./context.js";
|
|
2
|
-
export type { YakConfig, YakContextValue } from "./context.js";
|
|
1
|
+
export { useYak, useYakToolEvent } from "./context.js";
|
|
2
|
+
export type { YakConfig, YakContextValue, ToolCallEventHandler } from "./context.js";
|
|
3
3
|
export { YakProvider } from "./YakProvider.js";
|
|
4
4
|
export type { YakProviderProps } from "./YakProvider.js";
|
|
5
5
|
export { YakWidget } from "./YakWidget.js";
|
|
6
6
|
export type { YakWidgetProps } from "./YakWidget.js";
|
|
7
|
-
export { type GraphQLSchemaHandler, type RESTSchemaHandler, type GraphQLRequest, type RESTRequest, type ToolCallHandler, type SchemaSource, type GraphQLSchemaSource, type OpenAPISchemaSource, type Theme, type ThemeColors, type ButtonColors, } from "@yak-io/javascript";
|
|
7
|
+
export { type GraphQLSchemaHandler, type RESTSchemaHandler, type GraphQLRequest, type RESTRequest, type ToolCallHandler, type ToolCallEvent, type SchemaSource, type GraphQLSchemaSource, type OpenAPISchemaSource, type Theme, type ThemeColors, type ButtonColors, } from "@yak-io/javascript";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACvD,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Warnings and errors are always logged.
|
|
2
|
+
* Re-export logger from @yak-io/javascript.
|
|
3
|
+
* All logging configuration is centralized there.
|
|
5
4
|
*/
|
|
6
|
-
export
|
|
7
|
-
debug: (message: string, data?: unknown) => void;
|
|
8
|
-
info: (message: string, data?: unknown) => void;
|
|
9
|
-
warn: (message: string, data?: unknown) => void;
|
|
10
|
-
error: (message: string, data?: unknown) => void;
|
|
11
|
-
};
|
|
5
|
+
export { logger } from "@yak-io/javascript";
|
|
12
6
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/internal/logger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/internal/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/internal/logger.js
CHANGED
|
@@ -1,44 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Warnings and errors are always logged.
|
|
2
|
+
* Re-export logger from @yak-io/javascript.
|
|
3
|
+
* All logging configuration is centralized there.
|
|
5
4
|
*/
|
|
6
|
-
|
|
7
|
-
export const logger = {
|
|
8
|
-
debug: (message, data) => {
|
|
9
|
-
if (isDev) {
|
|
10
|
-
if (data !== undefined) {
|
|
11
|
-
console.log(`[yak-chat-host] ${message}`, data);
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
console.log(`[yak-chat-host] ${message}`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
info: (message, data) => {
|
|
19
|
-
if (isDev) {
|
|
20
|
-
if (data !== undefined) {
|
|
21
|
-
console.info(`[yak-chat-host] ${message}`, data);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
console.info(`[yak-chat-host] ${message}`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
warn: (message, data) => {
|
|
29
|
-
if (data !== undefined) {
|
|
30
|
-
console.warn(`[yak-chat-host] ${message}`, data);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
console.warn(`[yak-chat-host] ${message}`);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
error: (message, data) => {
|
|
37
|
-
if (data !== undefined) {
|
|
38
|
-
console.error(`[yak-chat-host] ${message}`, data);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
console.error(`[yak-chat-host] ${message}`);
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
};
|
|
5
|
+
export { logger } from "@yak-io/javascript";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yak-io/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "React SDK for embedding yak chatbot",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@yak-io/javascript": "0.
|
|
44
|
+
"@yak-io/javascript": "0.3.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^18.0.0 || ^19.0.0",
|