@menuia/react 1.0.0 → 1.1.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/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +3 -1
- package/dist/index.mjs +3 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,11 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { MenuIAConfig, ChatMessage, ConnectionStatus } from '@menuia/core';
|
|
3
3
|
export { ChatMessage, ConnectionStatus, MenuIAClient, MenuIAConfig, MessageAttachment, SendMessageOptions } from '@menuia/core';
|
|
4
4
|
|
|
5
|
-
interface MenuIAChatProps extends MenuIAConfig {
|
|
5
|
+
interface MenuIAChatProps extends Omit<MenuIAConfig, 'widgetId' | 'agentId'> {
|
|
6
|
+
/** Widget ID (from /dashboard/channels) - preferred */
|
|
7
|
+
widgetId?: string;
|
|
8
|
+
/** Agent ID (from /dashboard/agents) - fallback */
|
|
9
|
+
agentId?: string;
|
|
6
10
|
/** Chat window title */
|
|
7
11
|
title?: string;
|
|
8
12
|
/** Subtitle below title */
|
|
@@ -30,7 +34,7 @@ interface MenuIAChatProps extends MenuIAConfig {
|
|
|
30
34
|
/** Show powered by MenuIA */
|
|
31
35
|
showPoweredBy?: boolean;
|
|
32
36
|
}
|
|
33
|
-
declare function MenuIAChat({ title, subtitle, avatar, primaryColor, theme, position, welcomeMessage, placeholder, defaultOpen, inline, width, height, showPoweredBy, agentId, apiUrl, sessionId, customFields, metadata, channel, onMessage, onStatusChange, onTicketCreated, onError, }: MenuIAChatProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function MenuIAChat({ title, subtitle, avatar, primaryColor, theme, position, welcomeMessage, placeholder, defaultOpen, inline, width, height, showPoweredBy, widgetId, agentId, apiUrl, sessionId, customFields, metadata, channel, onMessage, onStatusChange, onTicketCreated, onError, }: MenuIAChatProps): react_jsx_runtime.JSX.Element;
|
|
34
38
|
|
|
35
39
|
interface UseMenuIAReturn {
|
|
36
40
|
messages: ChatMessage[];
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,11 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { MenuIAConfig, ChatMessage, ConnectionStatus } from '@menuia/core';
|
|
3
3
|
export { ChatMessage, ConnectionStatus, MenuIAClient, MenuIAConfig, MessageAttachment, SendMessageOptions } from '@menuia/core';
|
|
4
4
|
|
|
5
|
-
interface MenuIAChatProps extends MenuIAConfig {
|
|
5
|
+
interface MenuIAChatProps extends Omit<MenuIAConfig, 'widgetId' | 'agentId'> {
|
|
6
|
+
/** Widget ID (from /dashboard/channels) - preferred */
|
|
7
|
+
widgetId?: string;
|
|
8
|
+
/** Agent ID (from /dashboard/agents) - fallback */
|
|
9
|
+
agentId?: string;
|
|
6
10
|
/** Chat window title */
|
|
7
11
|
title?: string;
|
|
8
12
|
/** Subtitle below title */
|
|
@@ -30,7 +34,7 @@ interface MenuIAChatProps extends MenuIAConfig {
|
|
|
30
34
|
/** Show powered by MenuIA */
|
|
31
35
|
showPoweredBy?: boolean;
|
|
32
36
|
}
|
|
33
|
-
declare function MenuIAChat({ title, subtitle, avatar, primaryColor, theme, position, welcomeMessage, placeholder, defaultOpen, inline, width, height, showPoweredBy, agentId, apiUrl, sessionId, customFields, metadata, channel, onMessage, onStatusChange, onTicketCreated, onError, }: MenuIAChatProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function MenuIAChat({ title, subtitle, avatar, primaryColor, theme, position, welcomeMessage, placeholder, defaultOpen, inline, width, height, showPoweredBy, widgetId, agentId, apiUrl, sessionId, customFields, metadata, channel, onMessage, onStatusChange, onTicketCreated, onError, }: MenuIAChatProps): react_jsx_runtime.JSX.Element;
|
|
34
38
|
|
|
35
39
|
interface UseMenuIAReturn {
|
|
36
40
|
messages: ChatMessage[];
|
package/dist/index.js
CHANGED
|
@@ -74,7 +74,7 @@ function useMenuIA(config) {
|
|
|
74
74
|
client.destroy();
|
|
75
75
|
clientRef.current = null;
|
|
76
76
|
};
|
|
77
|
-
}, [config.agentId, config.apiUrl]);
|
|
77
|
+
}, [config.widgetId, config.agentId, config.apiUrl]);
|
|
78
78
|
const sendMessage = (0, import_react.useCallback)(async (content) => {
|
|
79
79
|
if (!clientRef.current || !content.trim()) return;
|
|
80
80
|
setError(null);
|
|
@@ -416,6 +416,7 @@ function MenuIAChat({
|
|
|
416
416
|
height,
|
|
417
417
|
showPoweredBy = true,
|
|
418
418
|
// Core config
|
|
419
|
+
widgetId,
|
|
419
420
|
agentId,
|
|
420
421
|
apiUrl,
|
|
421
422
|
sessionId,
|
|
@@ -440,6 +441,7 @@ function MenuIAChat({
|
|
|
440
441
|
sendMessage,
|
|
441
442
|
clearChat
|
|
442
443
|
} = useMenuIA({
|
|
444
|
+
widgetId,
|
|
443
445
|
agentId,
|
|
444
446
|
apiUrl,
|
|
445
447
|
sessionId,
|
package/dist/index.mjs
CHANGED
|
@@ -36,7 +36,7 @@ function useMenuIA(config) {
|
|
|
36
36
|
client.destroy();
|
|
37
37
|
clientRef.current = null;
|
|
38
38
|
};
|
|
39
|
-
}, [config.agentId, config.apiUrl]);
|
|
39
|
+
}, [config.widgetId, config.agentId, config.apiUrl]);
|
|
40
40
|
const sendMessage = useCallback(async (content) => {
|
|
41
41
|
if (!clientRef.current || !content.trim()) return;
|
|
42
42
|
setError(null);
|
|
@@ -378,6 +378,7 @@ function MenuIAChat({
|
|
|
378
378
|
height,
|
|
379
379
|
showPoweredBy = true,
|
|
380
380
|
// Core config
|
|
381
|
+
widgetId,
|
|
381
382
|
agentId,
|
|
382
383
|
apiUrl,
|
|
383
384
|
sessionId,
|
|
@@ -402,6 +403,7 @@ function MenuIAChat({
|
|
|
402
403
|
sendMessage,
|
|
403
404
|
clearChat
|
|
404
405
|
} = useMenuIA({
|
|
406
|
+
widgetId,
|
|
405
407
|
agentId,
|
|
406
408
|
apiUrl,
|
|
407
409
|
sessionId,
|