@novu/react 3.18.2 → 3.19.1-rc.68f5589d4e
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/cjs/components/telegram-connect-button/DefaultTelegramConnectButton.cjs +3 -0
- package/dist/cjs/components/telegram-connect-button/DefaultTelegramConnectButton.cjs.map +1 -1
- package/dist/cjs/components/telegram-connect-button/DefaultTelegramConnectButton.d.cts +1 -1
- package/dist/cjs/hooks/index.cjs +2 -0
- package/dist/cjs/hooks/index.cjs.map +1 -1
- package/dist/cjs/hooks/index.d.cts +1 -0
- package/dist/cjs/hooks/useAgentChat.cjs +312 -0
- package/dist/cjs/hooks/useAgentChat.cjs.map +1 -0
- package/dist/cjs/hooks/useAgentChat.d.cts +77 -0
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -0
- package/dist/cjs/server/index.cjs +19 -0
- package/dist/cjs/server/index.cjs.map +1 -1
- package/dist/cjs/server/index.d.cts +3 -1
- package/dist/esm/components/telegram-connect-button/DefaultTelegramConnectButton.d.ts +1 -1
- package/dist/esm/components/telegram-connect-button/DefaultTelegramConnectButton.js +3 -0
- package/dist/esm/components/telegram-connect-button/DefaultTelegramConnectButton.js.map +1 -1
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/useAgentChat.d.ts +77 -0
- package/dist/esm/hooks/useAgentChat.js +280 -0
- package/dist/esm/hooks/useAgentChat.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server/index.d.ts +3 -1
- package/dist/esm/server/index.js +18 -0
- package/dist/esm/server/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -32,6 +32,7 @@ var DefaultTelegramConnectButton = (props) => {
|
|
|
32
32
|
integrationIdentifier,
|
|
33
33
|
subscriberId,
|
|
34
34
|
context,
|
|
35
|
+
contextHash,
|
|
35
36
|
onConnectSuccess,
|
|
36
37
|
onConnectError,
|
|
37
38
|
onDisconnectSuccess,
|
|
@@ -48,6 +49,7 @@ var DefaultTelegramConnectButton = (props) => {
|
|
|
48
49
|
integrationIdentifier,
|
|
49
50
|
subscriberId,
|
|
50
51
|
context,
|
|
52
|
+
contextHash,
|
|
51
53
|
onConnectSuccess,
|
|
52
54
|
onConnectError,
|
|
53
55
|
onDisconnectSuccess,
|
|
@@ -63,6 +65,7 @@ var DefaultTelegramConnectButton = (props) => {
|
|
|
63
65
|
integrationIdentifier,
|
|
64
66
|
subscriberId,
|
|
65
67
|
context,
|
|
68
|
+
contextHash,
|
|
66
69
|
onConnectSuccess,
|
|
67
70
|
onConnectError,
|
|
68
71
|
onDisconnectSuccess,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/telegram-connect-button/DefaultTelegramConnectButton.tsx"],"sourcesContent":["import { TelegramConnectButtonProps } from '@novu/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultTelegramConnectButtonProps = Pick<\n TelegramConnectButtonProps,\n | 'integrationIdentifier'\n | 'subscriberId'\n | 'context'\n | 'onConnectSuccess'\n | 'onConnectError'\n | 'onDisconnectSuccess'\n | 'onDisconnectError'\n | 'connectLabel'\n | 'connectedLabel'\n>;\n\nexport const DefaultTelegramConnectButton = (props: DefaultTelegramConnectButtonProps) => {\n const {\n integrationIdentifier,\n subscriberId,\n context,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n } = props;\n const { novuUI } = useNovuUI();\n\n const mount = useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'TelegramConnectButton',\n props: {\n integrationIdentifier,\n subscriberId,\n context,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n },\n element,\n });\n },\n [\n novuUI,\n integrationIdentifier,\n subscriberId,\n context,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/telegram-connect-button/DefaultTelegramConnectButton.tsx"],"sourcesContent":["import { TelegramConnectButtonProps } from '@novu/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultTelegramConnectButtonProps = Pick<\n TelegramConnectButtonProps,\n | 'integrationIdentifier'\n | 'subscriberId'\n | 'context'\n | 'contextHash'\n | 'onConnectSuccess'\n | 'onConnectError'\n | 'onDisconnectSuccess'\n | 'onDisconnectError'\n | 'connectLabel'\n | 'connectedLabel'\n>;\n\nexport const DefaultTelegramConnectButton = (props: DefaultTelegramConnectButtonProps) => {\n const {\n integrationIdentifier,\n subscriberId,\n context,\n contextHash,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n } = props;\n const { novuUI } = useNovuUI();\n\n const mount = useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'TelegramConnectButton',\n props: {\n integrationIdentifier,\n subscriberId,\n context,\n contextHash,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n },\n element,\n });\n },\n [\n novuUI,\n integrationIdentifier,\n subscriberId,\n context,\n contextHash,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAC5B,2BAA0B;AAC1B,qBAAwB;AAiEf;AAjDF,IAAM,+BAA+B,CAAC,UAA6C;AACxF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,QAAI,gCAAU;AAE7B,QAAM,YAAQ;AAAA,IACZ,CAAC,YAAyB;AACxB,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,0BAAQ,OAAc;AAChC;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { TelegramConnectButtonProps } from '@novu/js/ui';
|
|
3
3
|
|
|
4
|
-
type DefaultTelegramConnectButtonProps = Pick<TelegramConnectButtonProps, 'integrationIdentifier' | 'subscriberId' | 'context' | 'onConnectSuccess' | 'onConnectError' | 'onDisconnectSuccess' | 'onDisconnectError' | 'connectLabel' | 'connectedLabel'>;
|
|
4
|
+
type DefaultTelegramConnectButtonProps = Pick<TelegramConnectButtonProps, 'integrationIdentifier' | 'subscriberId' | 'context' | 'contextHash' | 'onConnectSuccess' | 'onConnectError' | 'onDisconnectSuccess' | 'onDisconnectError' | 'connectLabel' | 'connectedLabel'>;
|
|
5
5
|
declare const DefaultTelegramConnectButton: (props: DefaultTelegramConnectButtonProps) => react_jsx_runtime.JSX.Element;
|
|
6
6
|
|
|
7
7
|
export { DefaultTelegramConnectButton, type DefaultTelegramConnectButtonProps };
|
package/dist/cjs/hooks/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ __export(hooks_exports, {
|
|
|
30
30
|
module.exports = __toCommonJS(hooks_exports);
|
|
31
31
|
var import_js = require("@novu/js");
|
|
32
32
|
var import_NovuProvider = require("./NovuProvider.cjs");
|
|
33
|
+
__reExport(hooks_exports, require("./useAgentChat.cjs"), module.exports);
|
|
33
34
|
__reExport(hooks_exports, require("./useChannelConnection.cjs"), module.exports);
|
|
34
35
|
__reExport(hooks_exports, require("./useChannelConnections.cjs"), module.exports);
|
|
35
36
|
__reExport(hooks_exports, require("./useChannelEndpoint.cjs"), module.exports);
|
|
@@ -54,6 +55,7 @@ __reExport(hooks_exports, require("./useUpdateSubscription.cjs"), module.exports
|
|
|
54
55
|
SeverityLevelEnum,
|
|
55
56
|
WorkflowCriticalityEnum,
|
|
56
57
|
useNovu,
|
|
58
|
+
...require("./useAgentChat.cjs"),
|
|
57
59
|
...require("./useChannelConnection.cjs"),
|
|
58
60
|
...require("./useChannelConnections.cjs"),
|
|
59
61
|
...require("./useChannelEndpoint.cjs"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export type * from '@novu/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';\nexport { NovuProvider, useNovu } from './NovuProvider';\nexport * from './useChannelConnection';\nexport * from './useChannelConnections';\nexport * from './useChannelEndpoint';\nexport * from './useChannelEndpoints';\nexport * from './useCounts';\nexport * from './useCreateChannelEndpoint';\nexport * from './useCreateSubscription';\nexport * from './useDeleteChannelConnection';\nexport * from './useDeleteChannelEndpoint';\nexport * from './useNotifications';\nexport * from './usePreferences';\nexport * from './useRemoveSubscription';\nexport * from './useSchedule';\nexport * from './useSubscription';\nexport * from './useSubscriptions';\nexport * from './useTelegramSubscriberLink';\nexport * from './useUpdateSubscription';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAA4E;AAC5E,0BAAsC;AACtC,0BAAc
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export type * from '@novu/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';\nexport { NovuProvider, useNovu } from './NovuProvider';\nexport * from './useAgentChat';\nexport * from './useChannelConnection';\nexport * from './useChannelConnections';\nexport * from './useChannelEndpoint';\nexport * from './useChannelEndpoints';\nexport * from './useCounts';\nexport * from './useCreateChannelEndpoint';\nexport * from './useCreateSubscription';\nexport * from './useDeleteChannelConnection';\nexport * from './useDeleteChannelEndpoint';\nexport * from './useNotifications';\nexport * from './usePreferences';\nexport * from './useRemoveSubscription';\nexport * from './useSchedule';\nexport * from './useSubscription';\nexport * from './useSubscriptions';\nexport * from './useTelegramSubscriberLink';\nexport * from './useUpdateSubscription';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAA4E;AAC5E,0BAAsC;AACtC,0BAAc,+BAHd;AAIA,0BAAc,uCAJd;AAKA,0BAAc,wCALd;AAMA,0BAAc,qCANd;AAOA,0BAAc,sCAPd;AAQA,0BAAc,4BARd;AASA,0BAAc,2CATd;AAUA,0BAAc,wCAVd;AAWA,0BAAc,6CAXd;AAYA,0BAAc,2CAZd;AAaA,0BAAc,mCAbd;AAcA,0BAAc,iCAdd;AAeA,0BAAc,wCAfd;AAgBA,0BAAc,8BAhBd;AAiBA,0BAAc,kCAjBd;AAkBA,0BAAc,mCAlBd;AAmBA,0BAAc,4CAnBd;AAoBA,0BAAc,wCApBd;","names":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from '@novu/js';
|
|
2
2
|
export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';
|
|
3
3
|
export { NovuProvider, useNovu } from './NovuProvider.cjs';
|
|
4
|
+
export { UseAgentChatProps, UseAgentChatResult, useAgentChat } from './useAgentChat.cjs';
|
|
4
5
|
export { UseChannelConnectionProps, UseChannelConnectionResult, useChannelConnection } from './useChannelConnection.cjs';
|
|
5
6
|
export { UseChannelConnectionsProps, UseChannelConnectionsResult, useChannelConnections } from './useChannelConnections.cjs';
|
|
6
7
|
export { UseChannelEndpointProps, UseChannelEndpointResult, useChannelEndpoint } from './useChannelEndpoint.cjs';
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/hooks/useAgentChat.ts
|
|
21
|
+
var useAgentChat_exports = {};
|
|
22
|
+
__export(useAgentChat_exports, {
|
|
23
|
+
useAgentChat: () => useAgentChat
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(useAgentChat_exports);
|
|
26
|
+
var import_js = require("@novu/js");
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_useDataRef = require("./internal/useDataRef.cjs");
|
|
29
|
+
var import_NovuProvider = require("./NovuProvider.cjs");
|
|
30
|
+
function createLocalSessionKey() {
|
|
31
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
32
|
+
return `local_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}`;
|
|
33
|
+
}
|
|
34
|
+
if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
|
|
35
|
+
const bytes = new Uint8Array(6);
|
|
36
|
+
crypto.getRandomValues(bytes);
|
|
37
|
+
return `local_${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
38
|
+
}
|
|
39
|
+
return `local_${Date.now().toString(36)}`;
|
|
40
|
+
}
|
|
41
|
+
var EMPTY_CONVERSATION = {
|
|
42
|
+
messages: [],
|
|
43
|
+
isRunning: false,
|
|
44
|
+
typing: void 0,
|
|
45
|
+
status: "active",
|
|
46
|
+
hasMore: false
|
|
47
|
+
};
|
|
48
|
+
function applyConversationSnapshot(snapshot, setters) {
|
|
49
|
+
setters.setMessages(snapshot.messages);
|
|
50
|
+
setters.setIsRunning(snapshot.isRunning);
|
|
51
|
+
setters.setTyping(snapshot.typing);
|
|
52
|
+
setters.setStatus(snapshot.status);
|
|
53
|
+
setters.setHasMore(snapshot.hasMore);
|
|
54
|
+
}
|
|
55
|
+
var useAgentChat = (props) => {
|
|
56
|
+
const { agentId, agentHash, conversationId: conversationIdProp } = props;
|
|
57
|
+
const propsRef = (0, import_useDataRef.useDataRef)(props);
|
|
58
|
+
const novu = (0, import_NovuProvider.useNovu)();
|
|
59
|
+
const [localSessionKey, setLocalSessionKey] = (0, import_react.useState)(createLocalSessionKey);
|
|
60
|
+
const sessionKey = conversationIdProp ?? localSessionKey;
|
|
61
|
+
const sessionKeyRef = (0, import_useDataRef.useDataRef)(sessionKey);
|
|
62
|
+
const prevAgentIdRef = (0, import_react.useRef)(agentId);
|
|
63
|
+
const prevConversationIdPropRef = (0, import_react.useRef)(conversationIdProp);
|
|
64
|
+
const [assignedConversationId, setAssignedConversationId] = (0, import_react.useState)();
|
|
65
|
+
const conversationId = conversationIdProp ?? assignedConversationId;
|
|
66
|
+
const conversationIdRef = (0, import_useDataRef.useDataRef)(conversationId);
|
|
67
|
+
const [messages, setMessages] = (0, import_react.useState)([]);
|
|
68
|
+
const [isRunning, setIsRunning] = (0, import_react.useState)(false);
|
|
69
|
+
const [typing, setTyping] = (0, import_react.useState)();
|
|
70
|
+
const [status, setStatus] = (0, import_react.useState)("active");
|
|
71
|
+
const [hasMore, setHasMore] = (0, import_react.useState)(false);
|
|
72
|
+
const [error, setError] = (0, import_react.useState)();
|
|
73
|
+
const [isLoading, setIsLoading] = (0, import_react.useState)(Boolean(conversationIdProp));
|
|
74
|
+
const [isFetching, setIsFetching] = (0, import_react.useState)(false);
|
|
75
|
+
const fetchGenerationRef = (0, import_react.useRef)(0);
|
|
76
|
+
const pendingActions = (0, import_react.useMemo)(() => (0, import_js.derivePendingActions)(messages), [messages]);
|
|
77
|
+
const snapshotSetters = (0, import_react.useMemo)(
|
|
78
|
+
() => ({
|
|
79
|
+
setMessages,
|
|
80
|
+
setIsRunning,
|
|
81
|
+
setTyping,
|
|
82
|
+
setStatus,
|
|
83
|
+
setHasMore
|
|
84
|
+
}),
|
|
85
|
+
[]
|
|
86
|
+
);
|
|
87
|
+
(0, import_react.useEffect)(() => {
|
|
88
|
+
const agentChanged = prevAgentIdRef.current !== agentId;
|
|
89
|
+
const prevConversationIdProp = prevConversationIdPropRef.current;
|
|
90
|
+
prevAgentIdRef.current = agentId;
|
|
91
|
+
prevConversationIdPropRef.current = conversationIdProp;
|
|
92
|
+
if (agentChanged) {
|
|
93
|
+
setAssignedConversationId(void 0);
|
|
94
|
+
setLocalSessionKey(createLocalSessionKey());
|
|
95
|
+
applyConversationSnapshot(EMPTY_CONVERSATION, snapshotSetters);
|
|
96
|
+
setError(void 0);
|
|
97
|
+
setIsLoading(Boolean(conversationIdProp));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (conversationIdProp) {
|
|
101
|
+
setAssignedConversationId(void 0);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
setIsLoading(false);
|
|
105
|
+
if (prevConversationIdProp !== void 0) {
|
|
106
|
+
setAssignedConversationId(void 0);
|
|
107
|
+
setLocalSessionKey(createLocalSessionKey());
|
|
108
|
+
applyConversationSnapshot(EMPTY_CONVERSATION, snapshotSetters);
|
|
109
|
+
}
|
|
110
|
+
}, [agentId, conversationIdProp, snapshotSetters]);
|
|
111
|
+
const fetchConversation = (0, import_react.useCallback)(
|
|
112
|
+
async (targetConversationId) => {
|
|
113
|
+
var _a, _b, _c, _d;
|
|
114
|
+
const generation = ++fetchGenerationRef.current;
|
|
115
|
+
setError(void 0);
|
|
116
|
+
setIsLoading(true);
|
|
117
|
+
setIsFetching(true);
|
|
118
|
+
const response = await novu.agentChat.loadConversation({
|
|
119
|
+
agentId,
|
|
120
|
+
conversationId: targetConversationId
|
|
121
|
+
});
|
|
122
|
+
if (generation !== fetchGenerationRef.current) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (response.error) {
|
|
126
|
+
setError(response.error);
|
|
127
|
+
(_b = (_a = propsRef.current).onError) == null ? void 0 : _b.call(_a, response.error);
|
|
128
|
+
} else if (response.data) {
|
|
129
|
+
setMessages(response.data.messages);
|
|
130
|
+
setHasMore(response.data.hasMore);
|
|
131
|
+
(_d = (_c = propsRef.current).onSuccess) == null ? void 0 : _d.call(_c, response.data);
|
|
132
|
+
}
|
|
133
|
+
setIsLoading(false);
|
|
134
|
+
setIsFetching(false);
|
|
135
|
+
},
|
|
136
|
+
[novu, agentId, propsRef]
|
|
137
|
+
);
|
|
138
|
+
(0, import_react.useEffect)(() => {
|
|
139
|
+
var _a, _b;
|
|
140
|
+
novu.agentChat.subscribe();
|
|
141
|
+
const snapshot = novu.agentChat.getConversation({
|
|
142
|
+
agentId,
|
|
143
|
+
key: sessionKey,
|
|
144
|
+
conversationId: conversationIdProp
|
|
145
|
+
});
|
|
146
|
+
if (snapshot) {
|
|
147
|
+
applyConversationSnapshot(
|
|
148
|
+
{
|
|
149
|
+
messages: snapshot.messages,
|
|
150
|
+
isRunning: snapshot.isRunning,
|
|
151
|
+
typing: snapshot.typing,
|
|
152
|
+
status: snapshot.status,
|
|
153
|
+
hasMore: snapshot.hasMore
|
|
154
|
+
},
|
|
155
|
+
snapshotSetters
|
|
156
|
+
);
|
|
157
|
+
if (snapshot.conversationId && !conversationIdProp) {
|
|
158
|
+
setAssignedConversationId(snapshot.conversationId);
|
|
159
|
+
}
|
|
160
|
+
for (const action of (0, import_js.derivePendingActions)(snapshot.messages)) {
|
|
161
|
+
(_b = (_a = propsRef.current).onActionRequested) == null ? void 0 : _b.call(_a, action);
|
|
162
|
+
}
|
|
163
|
+
} else if (!conversationIdProp) {
|
|
164
|
+
applyConversationSnapshot(EMPTY_CONVERSATION, snapshotSetters);
|
|
165
|
+
}
|
|
166
|
+
const cleanup = novu.on("agent_chat.messages.updated", ({ data }) => {
|
|
167
|
+
var _a2, _b2, _c, _d, _e, _f;
|
|
168
|
+
if (data.key !== sessionKeyRef.current) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
applyConversationSnapshot(
|
|
172
|
+
{
|
|
173
|
+
messages: data.messages,
|
|
174
|
+
isRunning: data.isRunning,
|
|
175
|
+
typing: data.typing,
|
|
176
|
+
status: data.status,
|
|
177
|
+
hasMore: data.hasMore
|
|
178
|
+
},
|
|
179
|
+
snapshotSetters
|
|
180
|
+
);
|
|
181
|
+
if (data.conversationId && !propsRef.current.conversationId) {
|
|
182
|
+
setAssignedConversationId(data.conversationId);
|
|
183
|
+
}
|
|
184
|
+
const { change } = data;
|
|
185
|
+
if (change.kind === "live") {
|
|
186
|
+
(_b2 = (_a2 = propsRef.current).onEvent) == null ? void 0 : _b2.call(_a2, change.envelope);
|
|
187
|
+
}
|
|
188
|
+
if (change.kind !== "history") {
|
|
189
|
+
for (const message of change.addedMessages) {
|
|
190
|
+
(_d = (_c = propsRef.current).onMessage) == null ? void 0 : _d.call(_c, message);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
for (const action of change.newActions) {
|
|
194
|
+
(_f = (_e = propsRef.current).onActionRequested) == null ? void 0 : _f.call(_e, action);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
if (conversationIdProp) {
|
|
198
|
+
void fetchConversation(conversationIdProp);
|
|
199
|
+
}
|
|
200
|
+
return () => {
|
|
201
|
+
cleanup();
|
|
202
|
+
novu.agentChat.unsubscribe();
|
|
203
|
+
};
|
|
204
|
+
}, [novu, agentId, conversationIdProp, sessionKey, sessionKeyRef, propsRef, fetchConversation, snapshotSetters]);
|
|
205
|
+
const refetch = (0, import_react.useCallback)(async () => {
|
|
206
|
+
const id = conversationIdRef.current;
|
|
207
|
+
if (!id) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
await fetchConversation(id);
|
|
211
|
+
}, [conversationIdRef, fetchConversation]);
|
|
212
|
+
const fetchMore = (0, import_react.useCallback)(async () => {
|
|
213
|
+
var _a, _b;
|
|
214
|
+
const response = await novu.agentChat.fetchMore({
|
|
215
|
+
agentId,
|
|
216
|
+
key: sessionKeyRef.current,
|
|
217
|
+
conversationId: conversationIdRef.current
|
|
218
|
+
});
|
|
219
|
+
if (response.error) {
|
|
220
|
+
setError(response.error);
|
|
221
|
+
(_b = (_a = propsRef.current).onError) == null ? void 0 : _b.call(_a, response.error);
|
|
222
|
+
} else if (response.data) {
|
|
223
|
+
setMessages(response.data.messages);
|
|
224
|
+
setHasMore(response.data.hasMore);
|
|
225
|
+
}
|
|
226
|
+
return response;
|
|
227
|
+
}, [novu, agentId, sessionKeyRef, conversationIdRef, propsRef]);
|
|
228
|
+
const sendMessage = (0, import_react.useCallback)(
|
|
229
|
+
async (text) => {
|
|
230
|
+
var _a, _b;
|
|
231
|
+
setError(void 0);
|
|
232
|
+
const response = await novu.agentChat.sendMessage({
|
|
233
|
+
agentId,
|
|
234
|
+
agentHash,
|
|
235
|
+
text,
|
|
236
|
+
key: sessionKeyRef.current,
|
|
237
|
+
conversationId: conversationIdRef.current
|
|
238
|
+
});
|
|
239
|
+
if (response.error) {
|
|
240
|
+
setError(response.error);
|
|
241
|
+
(_b = (_a = propsRef.current).onError) == null ? void 0 : _b.call(_a, response.error);
|
|
242
|
+
} else if (response.data && !propsRef.current.conversationId) {
|
|
243
|
+
setAssignedConversationId(response.data.conversationId);
|
|
244
|
+
}
|
|
245
|
+
return response;
|
|
246
|
+
},
|
|
247
|
+
[novu, agentId, agentHash, sessionKeyRef, conversationIdRef, propsRef]
|
|
248
|
+
);
|
|
249
|
+
const respondToAction = (0, import_react.useCallback)(
|
|
250
|
+
async (args) => {
|
|
251
|
+
var _a, _b;
|
|
252
|
+
setError(void 0);
|
|
253
|
+
const response = await novu.agentChat.respondToAction({
|
|
254
|
+
agentId,
|
|
255
|
+
agentHash,
|
|
256
|
+
key: sessionKeyRef.current,
|
|
257
|
+
conversationId: conversationIdRef.current,
|
|
258
|
+
actionId: args.actionId,
|
|
259
|
+
decision: args.decision
|
|
260
|
+
});
|
|
261
|
+
if (response.error) {
|
|
262
|
+
setError(response.error);
|
|
263
|
+
(_b = (_a = propsRef.current).onError) == null ? void 0 : _b.call(_a, response.error);
|
|
264
|
+
}
|
|
265
|
+
return response;
|
|
266
|
+
},
|
|
267
|
+
[novu, agentId, agentHash, sessionKeyRef, conversationIdRef, propsRef]
|
|
268
|
+
);
|
|
269
|
+
const sendAction = (0, import_react.useCallback)(
|
|
270
|
+
async (args) => {
|
|
271
|
+
var _a, _b;
|
|
272
|
+
setError(void 0);
|
|
273
|
+
const response = await novu.agentChat.sendAction({
|
|
274
|
+
agentId,
|
|
275
|
+
agentHash,
|
|
276
|
+
key: sessionKeyRef.current,
|
|
277
|
+
conversationId: conversationIdRef.current,
|
|
278
|
+
actionId: args.actionId,
|
|
279
|
+
sourceMessageId: args.sourceMessageId,
|
|
280
|
+
value: args.value
|
|
281
|
+
});
|
|
282
|
+
if (response.error) {
|
|
283
|
+
setError(response.error);
|
|
284
|
+
(_b = (_a = propsRef.current).onError) == null ? void 0 : _b.call(_a, response.error);
|
|
285
|
+
}
|
|
286
|
+
return response;
|
|
287
|
+
},
|
|
288
|
+
[novu, agentId, agentHash, sessionKeyRef, conversationIdRef, propsRef]
|
|
289
|
+
);
|
|
290
|
+
return {
|
|
291
|
+
messages,
|
|
292
|
+
pendingActions,
|
|
293
|
+
sendMessage,
|
|
294
|
+
respondToAction,
|
|
295
|
+
sendAction,
|
|
296
|
+
conversationId,
|
|
297
|
+
error,
|
|
298
|
+
isLoading,
|
|
299
|
+
isFetching,
|
|
300
|
+
isRunning,
|
|
301
|
+
typing,
|
|
302
|
+
status,
|
|
303
|
+
hasMore,
|
|
304
|
+
refetch,
|
|
305
|
+
fetchMore
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
309
|
+
0 && (module.exports = {
|
|
310
|
+
useAgentChat
|
|
311
|
+
});
|
|
312
|
+
//# sourceMappingURL=useAgentChat.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/useAgentChat.ts"],"sourcesContent":["import type {\n AgentChatPlanLimitError,\n AgentConversationStatus,\n AgentConversationTyping,\n AgentEventEnvelope,\n AgentHashFields,\n AgentMessage,\n AgentPendingAction,\n AgentToolApprovalDecision,\n LoadConversationResult,\n NovuError,\n RespondToActionResult,\n SendActionResult,\n SendMessageResult,\n} from '@novu/js';\nimport { derivePendingActions } from '@novu/js';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useDataRef } from './internal/useDataRef';\nimport { useNovu } from './NovuProvider';\n\nexport type UseAgentChatProps = AgentHashFields & {\n agentId: string;\n /**\n * Resume this conversation. The hook loads history on mount.\n * Omit this prop to start a new chat. The first send creates a conversation.\n * Later sends pass the returned id. Remount or clear this prop to start another chat.\n */\n conversationId?: string;\n onSuccess?: (data: LoadConversationResult) => void;\n onError?: (error: NovuError | AgentChatPlanLimitError) => void;\n /**\n * Fires once per message, when the message id first appears on the conversation.\n * History pages are silent: only new activity fires.\n * An agent message can still be empty at this point, because the first envelope of a\n * turn creates the message before any text is folded into it.\n * A send that never reaches the server does not fire: the message flips to `failed` instead.\n */\n onMessage?: (message: AgentMessage) => void;\n /**\n * Fires once per pending action, including actions still pending on mount, so a\n * resumed conversation reports what it is blocked on. Paging backwards is silent.\n */\n onActionRequested?: (action: AgentPendingAction) => void;\n /**\n * Raw envelopes for this conversation, before the derived callbacks for the same fold.\n * A duplicate envelope that the store drops does not fire. Neither does an envelope that\n * arrives before a newly created conversation claims its id.\n * The store folds the envelope before this callback runs, so `messages` here is one render old.\n */\n onEvent?: (envelope: AgentEventEnvelope) => void;\n};\n\nexport type UseAgentChatResult = {\n messages: AgentMessage[];\n pendingActions: AgentPendingAction[];\n conversationId?: string;\n error?: NovuError | AgentChatPlanLimitError;\n /** True until the first history fetch completes. False when there is no `conversationId` prop. */\n isLoading: boolean;\n isFetching: boolean;\n isRunning: boolean;\n typing?: AgentConversationTyping;\n status: AgentConversationStatus;\n /** True when older history pages are available via `fetchMore`. */\n hasMore: boolean;\n refetch: () => Promise<void>;\n fetchMore: () => Promise<{\n data?: { messages: AgentMessage[]; hasMore: boolean };\n error?: NovuError;\n }>;\n sendMessage: (text: string) => Promise<{\n data?: SendMessageResult;\n error?: NovuError | AgentChatPlanLimitError;\n }>;\n respondToAction: (args: { actionId: string; decision: AgentToolApprovalDecision }) => Promise<{\n data?: RespondToActionResult;\n error?: NovuError | AgentChatPlanLimitError;\n }>;\n sendAction: (args: { actionId: string; sourceMessageId: string; value?: string }) => Promise<{\n data?: SendActionResult;\n error?: NovuError | AgentChatPlanLimitError;\n }>;\n};\n\nfunction createLocalSessionKey(): string {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return `local_${crypto.randomUUID().replace(/-/g, '').slice(0, 12)}`;\n }\n\n if (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {\n const bytes = new Uint8Array(6);\n crypto.getRandomValues(bytes);\n\n return `local_${Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('')}`;\n }\n\n return `local_${Date.now().toString(36)}`;\n}\n\ntype ConversationSnapshot = {\n messages: AgentMessage[];\n isRunning: boolean;\n typing?: AgentConversationTyping;\n status: AgentConversationStatus;\n hasMore: boolean;\n};\n\nconst EMPTY_CONVERSATION: ConversationSnapshot = {\n messages: [],\n isRunning: false,\n typing: undefined,\n status: 'active',\n hasMore: false,\n};\n\nfunction applyConversationSnapshot(\n snapshot: ConversationSnapshot,\n setters: {\n setMessages: (messages: AgentMessage[]) => void;\n setIsRunning: (isRunning: boolean) => void;\n setTyping: (typing?: AgentConversationTyping) => void;\n setStatus: (status: AgentConversationStatus) => void;\n setHasMore: (hasMore: boolean) => void;\n }\n): void {\n setters.setMessages(snapshot.messages);\n setters.setIsRunning(snapshot.isRunning);\n setters.setTyping(snapshot.typing);\n setters.setStatus(snapshot.status);\n setters.setHasMore(snapshot.hasMore);\n}\n\nexport const useAgentChat = (props: UseAgentChatProps): UseAgentChatResult => {\n const { agentId, agentHash, conversationId: conversationIdProp } = props;\n const propsRef = useDataRef(props);\n const novu = useNovu();\n\n // Resume: the prop is the key on the same render (no effect lag).\n // Create: keep a `local_*` key until remount, prop clear, or agent change.\n const [localSessionKey, setLocalSessionKey] = useState(createLocalSessionKey);\n const sessionKey = conversationIdProp ?? localSessionKey;\n const sessionKeyRef = useDataRef(sessionKey);\n const prevAgentIdRef = useRef(agentId);\n const prevConversationIdPropRef = useRef(conversationIdProp);\n\n const [assignedConversationId, setAssignedConversationId] = useState<string>();\n const conversationId = conversationIdProp ?? assignedConversationId;\n const conversationIdRef = useDataRef(conversationId);\n\n const [messages, setMessages] = useState<AgentMessage[]>([]);\n const [isRunning, setIsRunning] = useState(false);\n const [typing, setTyping] = useState<AgentConversationTyping>();\n const [status, setStatus] = useState<AgentConversationStatus>('active');\n const [hasMore, setHasMore] = useState(false);\n const [error, setError] = useState<NovuError | AgentChatPlanLimitError>();\n const [isLoading, setIsLoading] = useState(Boolean(conversationIdProp));\n const [isFetching, setIsFetching] = useState(false);\n const fetchGenerationRef = useRef(0);\n\n const pendingActions = useMemo(() => derivePendingActions(messages), [messages]);\n\n const snapshotSetters = useMemo(\n () => ({\n setMessages,\n setIsRunning,\n setTyping,\n setStatus,\n setHasMore,\n }),\n []\n );\n\n useEffect(() => {\n const agentChanged = prevAgentIdRef.current !== agentId;\n const prevConversationIdProp = prevConversationIdPropRef.current;\n prevAgentIdRef.current = agentId;\n prevConversationIdPropRef.current = conversationIdProp;\n\n if (agentChanged) {\n setAssignedConversationId(undefined);\n setLocalSessionKey(createLocalSessionKey());\n applyConversationSnapshot(EMPTY_CONVERSATION, snapshotSetters);\n setError(undefined);\n setIsLoading(Boolean(conversationIdProp));\n\n return;\n }\n\n if (conversationIdProp) {\n setAssignedConversationId(undefined);\n\n return;\n }\n\n setIsLoading(false);\n if (prevConversationIdProp !== undefined) {\n setAssignedConversationId(undefined);\n setLocalSessionKey(createLocalSessionKey());\n applyConversationSnapshot(EMPTY_CONVERSATION, snapshotSetters);\n }\n }, [agentId, conversationIdProp, snapshotSetters]);\n\n const fetchConversation = useCallback(\n async (targetConversationId: string) => {\n const generation = ++fetchGenerationRef.current;\n setError(undefined);\n setIsLoading(true);\n setIsFetching(true);\n\n const response = await novu.agentChat.loadConversation({\n agentId,\n conversationId: targetConversationId,\n });\n\n if (generation !== fetchGenerationRef.current) {\n return;\n }\n\n if (response.error) {\n setError(response.error);\n propsRef.current.onError?.(response.error);\n } else if (response.data) {\n setMessages(response.data.messages);\n setHasMore(response.data.hasMore);\n propsRef.current.onSuccess?.(response.data);\n }\n\n setIsLoading(false);\n setIsFetching(false);\n },\n [novu, agentId, propsRef]\n );\n\n useEffect(() => {\n novu.agentChat.subscribe();\n\n const snapshot = novu.agentChat.getConversation({\n agentId,\n key: sessionKey,\n conversationId: conversationIdProp,\n });\n if (snapshot) {\n applyConversationSnapshot(\n {\n messages: snapshot.messages,\n isRunning: snapshot.isRunning,\n typing: snapshot.typing,\n status: snapshot.status,\n hasMore: snapshot.hasMore,\n },\n snapshotSetters\n );\n if (snapshot.conversationId && !conversationIdProp) {\n setAssignedConversationId(snapshot.conversationId);\n }\n\n // The store reports each action once per holder, and a holder outlives a mount.\n // Replay from the snapshot so a remount still learns what the run is blocked on.\n for (const action of derivePendingActions(snapshot.messages)) {\n propsRef.current.onActionRequested?.(action);\n }\n } else if (!conversationIdProp) {\n applyConversationSnapshot(EMPTY_CONVERSATION, snapshotSetters);\n }\n\n const cleanup = novu.on('agent_chat.messages.updated', ({ data }) => {\n if (data.key !== sessionKeyRef.current) {\n return;\n }\n\n applyConversationSnapshot(\n {\n messages: data.messages,\n isRunning: data.isRunning,\n typing: data.typing,\n status: data.status,\n hasMore: data.hasMore,\n },\n snapshotSetters\n );\n if (data.conversationId && !propsRef.current.conversationId) {\n setAssignedConversationId(data.conversationId);\n }\n\n const { change } = data;\n if (change.kind === 'live') {\n propsRef.current.onEvent?.(change.envelope);\n }\n\n if (change.kind !== 'history') {\n for (const message of change.addedMessages) {\n propsRef.current.onMessage?.(message);\n }\n }\n\n for (const action of change.newActions) {\n propsRef.current.onActionRequested?.(action);\n }\n });\n\n if (conversationIdProp) {\n void fetchConversation(conversationIdProp);\n }\n\n return () => {\n cleanup();\n novu.agentChat.unsubscribe();\n };\n }, [novu, agentId, conversationIdProp, sessionKey, sessionKeyRef, propsRef, fetchConversation, snapshotSetters]);\n\n const refetch = useCallback(async () => {\n const id = conversationIdRef.current;\n if (!id) {\n return;\n }\n\n await fetchConversation(id);\n }, [conversationIdRef, fetchConversation]);\n\n const fetchMore = useCallback(async () => {\n const response = await novu.agentChat.fetchMore({\n agentId,\n key: sessionKeyRef.current,\n conversationId: conversationIdRef.current,\n });\n\n if (response.error) {\n setError(response.error);\n propsRef.current.onError?.(response.error);\n } else if (response.data) {\n setMessages(response.data.messages);\n setHasMore(response.data.hasMore);\n }\n\n return response;\n }, [novu, agentId, sessionKeyRef, conversationIdRef, propsRef]);\n\n const sendMessage = useCallback(\n async (text: string) => {\n setError(undefined);\n\n const response = await novu.agentChat.sendMessage({\n agentId,\n agentHash,\n text,\n key: sessionKeyRef.current,\n conversationId: conversationIdRef.current,\n });\n\n if (response.error) {\n setError(response.error);\n propsRef.current.onError?.(response.error);\n } else if (response.data && !propsRef.current.conversationId) {\n setAssignedConversationId(response.data.conversationId);\n }\n\n return response;\n },\n [novu, agentId, agentHash, sessionKeyRef, conversationIdRef, propsRef]\n );\n\n const respondToAction = useCallback(\n async (args: { actionId: string; decision: AgentToolApprovalDecision }) => {\n setError(undefined);\n\n const response = await novu.agentChat.respondToAction({\n agentId,\n agentHash,\n key: sessionKeyRef.current,\n conversationId: conversationIdRef.current,\n actionId: args.actionId,\n decision: args.decision,\n });\n\n if (response.error) {\n setError(response.error);\n propsRef.current.onError?.(response.error);\n }\n\n return response;\n },\n [novu, agentId, agentHash, sessionKeyRef, conversationIdRef, propsRef]\n );\n\n const sendAction = useCallback(\n async (args: { actionId: string; sourceMessageId: string; value?: string }) => {\n setError(undefined);\n\n const response = await novu.agentChat.sendAction({\n agentId,\n agentHash,\n key: sessionKeyRef.current,\n conversationId: conversationIdRef.current,\n actionId: args.actionId,\n sourceMessageId: args.sourceMessageId,\n value: args.value,\n });\n\n if (response.error) {\n setError(response.error);\n propsRef.current.onError?.(response.error);\n }\n\n return response;\n },\n [novu, agentId, agentHash, sessionKeyRef, conversationIdRef, propsRef]\n );\n\n return {\n messages,\n pendingActions,\n sendMessage,\n resp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KAAK,cAAc;AAAA,QACnB,gBAAgB,kBAAkB;AAAA,QAClC,UAAU,KAAK;AAAA,QACf,UAAU,KAAK;AAAA,MACjB,CAAC;AAED,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,6BAAS,SAAQ,YAAjB,4BAA2B,SAAS;AAAA,MACtC;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,MAAM,SAAS,WAAW,eAAe,mBAAmB,QAAQ;AAAA,EACvE;AAEA,QAAM,iBAAa;AAAA,IACjB,OAAO,SAAwE;AAjYnF;AAkYM,eAAS,MAAS;AAElB,YAAM,WAAW,MAAM,KAAK,UAAU,WAAW;AAAA,QAC/C;AAAA,QACA;AAAA,QACA,KAAK,cAAc;AAAA,QACnB,gBAAgB,kBAAkB;AAAA,QAClC,UAAU,KAAK;AAAA,QACf,iBAAiB,KAAK;AAAA,QACtB,OAAO,KAAK;AAAA,MACd,CAAC;AAED,UAAI,SAAS,OAAO;AAClB,iBAAS,SAAS,KAAK;AACvB,6BAAS,SAAQ,YAAjB,4BAA2B,SAAS;AAAA,MACtC;AAEA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,MAAM,SAAS,WAAW,eAAe,mBAAmB,QAAQ;AAAA,EACvE;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["_a","_b"]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AgentHashFields, LoadConversationResult, NovuError, AgentChatPlanLimitError, AgentMessage, AgentPendingAction, AgentEventEnvelope, AgentConversationTyping, AgentConversationStatus, SendMessageResult, AgentToolApprovalDecision, RespondToActionResult, SendActionResult } from '@novu/js';
|
|
2
|
+
|
|
3
|
+
type UseAgentChatProps = AgentHashFields & {
|
|
4
|
+
agentId: string;
|
|
5
|
+
/**
|
|
6
|
+
* Resume this conversation. The hook loads history on mount.
|
|
7
|
+
* Omit this prop to start a new chat. The first send creates a conversation.
|
|
8
|
+
* Later sends pass the returned id. Remount or clear this prop to start another chat.
|
|
9
|
+
*/
|
|
10
|
+
conversationId?: string;
|
|
11
|
+
onSuccess?: (data: LoadConversationResult) => void;
|
|
12
|
+
onError?: (error: NovuError | AgentChatPlanLimitError) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Fires once per message, when the message id first appears on the conversation.
|
|
15
|
+
* History pages are silent: only new activity fires.
|
|
16
|
+
* An agent message can still be empty at this point, because the first envelope of a
|
|
17
|
+
* turn creates the message before any text is folded into it.
|
|
18
|
+
* A send that never reaches the server does not fire: the message flips to `failed` instead.
|
|
19
|
+
*/
|
|
20
|
+
onMessage?: (message: AgentMessage) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Fires once per pending action, including actions still pending on mount, so a
|
|
23
|
+
* resumed conversation reports what it is blocked on. Paging backwards is silent.
|
|
24
|
+
*/
|
|
25
|
+
onActionRequested?: (action: AgentPendingAction) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Raw envelopes for this conversation, before the derived callbacks for the same fold.
|
|
28
|
+
* A duplicate envelope that the store drops does not fire. Neither does an envelope that
|
|
29
|
+
* arrives before a newly created conversation claims its id.
|
|
30
|
+
* The store folds the envelope before this callback runs, so `messages` here is one render old.
|
|
31
|
+
*/
|
|
32
|
+
onEvent?: (envelope: AgentEventEnvelope) => void;
|
|
33
|
+
};
|
|
34
|
+
type UseAgentChatResult = {
|
|
35
|
+
messages: AgentMessage[];
|
|
36
|
+
pendingActions: AgentPendingAction[];
|
|
37
|
+
conversationId?: string;
|
|
38
|
+
error?: NovuError | AgentChatPlanLimitError;
|
|
39
|
+
/** True until the first history fetch completes. False when there is no `conversationId` prop. */
|
|
40
|
+
isLoading: boolean;
|
|
41
|
+
isFetching: boolean;
|
|
42
|
+
isRunning: boolean;
|
|
43
|
+
typing?: AgentConversationTyping;
|
|
44
|
+
status: AgentConversationStatus;
|
|
45
|
+
/** True when older history pages are available via `fetchMore`. */
|
|
46
|
+
hasMore: boolean;
|
|
47
|
+
refetch: () => Promise<void>;
|
|
48
|
+
fetchMore: () => Promise<{
|
|
49
|
+
data?: {
|
|
50
|
+
messages: AgentMessage[];
|
|
51
|
+
hasMore: boolean;
|
|
52
|
+
};
|
|
53
|
+
error?: NovuError;
|
|
54
|
+
}>;
|
|
55
|
+
sendMessage: (text: string) => Promise<{
|
|
56
|
+
data?: SendMessageResult;
|
|
57
|
+
error?: NovuError | AgentChatPlanLimitError;
|
|
58
|
+
}>;
|
|
59
|
+
respondToAction: (args: {
|
|
60
|
+
actionId: string;
|
|
61
|
+
decision: AgentToolApprovalDecision;
|
|
62
|
+
}) => Promise<{
|
|
63
|
+
data?: RespondToActionResult;
|
|
64
|
+
error?: NovuError | AgentChatPlanLimitError;
|
|
65
|
+
}>;
|
|
66
|
+
sendAction: (args: {
|
|
67
|
+
actionId: string;
|
|
68
|
+
sourceMessageId: string;
|
|
69
|
+
value?: string;
|
|
70
|
+
}) => Promise<{
|
|
71
|
+
data?: SendActionResult;
|
|
72
|
+
error?: NovuError | AgentChatPlanLimitError;
|
|
73
|
+
}>;
|
|
74
|
+
};
|
|
75
|
+
declare const useAgentChat: (props: UseAgentChatProps) => UseAgentChatResult;
|
|
76
|
+
|
|
77
|
+
export { type UseAgentChatProps, type UseAgentChatResult, useAgentChat };
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
SubscriptionPreferences: () => import_components.SubscriptionPreferences,
|
|
38
38
|
TelegramConnectButton: () => import_components.TelegramConnectButton,
|
|
39
39
|
WorkflowCriticalityEnum: () => import_js.WorkflowCriticalityEnum,
|
|
40
|
+
useAgentChat: () => import_hooks.useAgentChat,
|
|
40
41
|
useChannelConnection: () => import_hooks.useChannelConnection,
|
|
41
42
|
useChannelConnections: () => import_hooks.useChannelConnections,
|
|
42
43
|
useChannelEndpoint: () => import_hooks.useChannelEndpoint,
|
|
@@ -77,6 +78,7 @@ var import_hooks = require("./hooks/index.cjs");
|
|
|
77
78
|
SubscriptionPreferences,
|
|
78
79
|
TelegramConnectButton,
|
|
79
80
|
WorkflowCriticalityEnum,
|
|
81
|
+
useAgentChat,
|
|
80
82
|
useChannelConnection,
|
|
81
83
|
useChannelConnections,
|
|
82
84
|
useChannelEndpoint,
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type * from '@novu/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';\n\nexport type {\n AllLocalization,\n AllLocalizationKey,\n ChannelConnectButtonIconKey,\n ElementStyles,\n InboxAppearance,\n InboxAppearanceCallback,\n InboxAppearanceCallbackFunction,\n InboxAppearanceCallbackKeys,\n InboxAppearanceKey,\n InboxElements,\n InboxLocalization,\n InboxLocalizationKey,\n InboxTheme,\n NotificationActionClickHandler,\n NotificationClickHandler,\n NotificationRenderer,\n PreferenceGroups,\n PreferencesFilter,\n RouterPush,\n SubscriptionAppearance,\n SubscriptionAppearanceCallback,\n SubscriptionAppearanceCallbackFunction,\n SubscriptionAppearanceCallbackKeys,\n SubscriptionAppearanceKey,\n SubscriptionElements,\n SubscriptionLocalization,\n SubscriptionLocalizationKey,\n SubscriptionTheme,\n Tab,\n Variables,\n} from '@novu/js/ui';\nexport type {\n BellProps,\n InboxContentProps,\n InboxProps,\n MsTeamsConnectButtonProps,\n MsTeamsLinkUserProps,\n NotificationProps,\n NovuProviderProps,\n SlackConnectButtonProps,\n SlackLinkUserProps,\n SubscriptionButtonProps,\n SubscriptionPreferencesProps,\n SubscriptionProps,\n TelegramConnectButtonProps,\n} from './components';\nexport {\n Bell,\n Inbox,\n InboxContent,\n MsTeamsConnectButton,\n MsTeamsLinkUser,\n Notifications,\n NovuProvider,\n Preferences,\n SlackConnectButton,\n SlackLinkUser,\n Subscription,\n SubscriptionButton,\n SubscriptionPreferences,\n TelegramConnectButton,\n} from './components';\nexport type {\n UseChannelConnectionProps,\n UseChannelConnectionResult,\n UseChannelConnectionsProps,\n UseChannelConnectionsResult,\n UseChannelEndpointProps,\n UseChannelEndpointResult,\n UseCountsProps,\n UseCountsResult,\n UseCreateChannelEndpointProps,\n UseCreateChannelEndpointResult,\n UseDeleteChannelEndpointProps,\n UseDeleteChannelEndpointResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n UseTelegramSubscriberLinkProps,\n UseTelegramSubscriberLinkResult,\n} from './hooks';\nexport {\n useChannelConnection,\n useChannelConnections,\n useChannelEndpoint,\n useCounts,\n useCreateChannelEndpoint,\n useCreateSubscription,\n useDeleteChannelEndpoint,\n useNotifications,\n useNovu,\n usePreferences,\n useRemoveSubscription,\n useSchedule,\n useSubscription,\n useSubscriptions,\n useTelegramSubscriberLink,\n useUpdateSubscription,\n} from './hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\n ReactAllAppearance,\n ReactInboxAppearance,\n ReactInboxTheme,\n ReactSubscriptionAppearance,\n ReactSubscriptionTheme,\n SubjectBodyRendererProps,\n SubjectRenderer,\n WithChildrenProps,\n} from './utils/types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAA4E;AAiD5E,wBAeO;
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type * from '@novu/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';\n\nexport type {\n AllLocalization,\n AllLocalizationKey,\n ChannelConnectButtonIconKey,\n ElementStyles,\n InboxAppearance,\n InboxAppearanceCallback,\n InboxAppearanceCallbackFunction,\n InboxAppearanceCallbackKeys,\n InboxAppearanceKey,\n InboxElements,\n InboxLocalization,\n InboxLocalizationKey,\n InboxTheme,\n NotificationActionClickHandler,\n NotificationClickHandler,\n NotificationRenderer,\n PreferenceGroups,\n PreferencesFilter,\n RouterPush,\n SubscriptionAppearance,\n SubscriptionAppearanceCallback,\n SubscriptionAppearanceCallbackFunction,\n SubscriptionAppearanceCallbackKeys,\n SubscriptionAppearanceKey,\n SubscriptionElements,\n SubscriptionLocalization,\n SubscriptionLocalizationKey,\n SubscriptionTheme,\n Tab,\n Variables,\n} from '@novu/js/ui';\nexport type {\n BellProps,\n InboxContentProps,\n InboxProps,\n MsTeamsConnectButtonProps,\n MsTeamsLinkUserProps,\n NotificationProps,\n NovuProviderProps,\n SlackConnectButtonProps,\n SlackLinkUserProps,\n SubscriptionButtonProps,\n SubscriptionPreferencesProps,\n SubscriptionProps,\n TelegramConnectButtonProps,\n} from './components';\nexport {\n Bell,\n Inbox,\n InboxContent,\n MsTeamsConnectButton,\n MsTeamsLinkUser,\n Notifications,\n NovuProvider,\n Preferences,\n SlackConnectButton,\n SlackLinkUser,\n Subscription,\n SubscriptionButton,\n SubscriptionPreferences,\n TelegramConnectButton,\n} from './components';\nexport type {\n UseAgentChatProps,\n UseAgentChatResult,\n UseChannelConnectionProps,\n UseChannelConnectionResult,\n UseChannelConnectionsProps,\n UseChannelConnectionsResult,\n UseChannelEndpointProps,\n UseChannelEndpointResult,\n UseCountsProps,\n UseCountsResult,\n UseCreateChannelEndpointProps,\n UseCreateChannelEndpointResult,\n UseDeleteChannelEndpointProps,\n UseDeleteChannelEndpointResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n UseTelegramSubscriberLinkProps,\n UseTelegramSubscriberLinkResult,\n} from './hooks';\nexport {\n useAgentChat,\n useChannelConnection,\n useChannelConnections,\n useChannelEndpoint,\n useCounts,\n useCreateChannelEndpoint,\n useCreateSubscription,\n useDeleteChannelEndpoint,\n useNotifications,\n useNovu,\n usePreferences,\n useRemoveSubscription,\n useSchedule,\n useSubscription,\n useSubscriptions,\n useTelegramSubscriberLink,\n useUpdateSubscription,\n} from './hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\n ReactAllAppearance,\n ReactInboxAppearance,\n ReactInboxTheme,\n ReactSubscriptionAppearance,\n ReactSubscriptionTheme,\n SubjectBodyRendererProps,\n SubjectRenderer,\n WithChildrenProps,\n} from './utils/types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAA4E;AAiD5E,wBAeO;AAuBP,mBAkBO;","names":[]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -15,6 +15,7 @@ export { Subscription, SubscriptionProps } from './components/subscription/Subsc
|
|
|
15
15
|
export { SubscriptionButton, SubscriptionButtonProps } from './components/subscription/SubscriptionButton.cjs';
|
|
16
16
|
export { SubscriptionPreferences, SubscriptionPreferencesProps } from './components/subscription/SubscriptionPreferences.cjs';
|
|
17
17
|
export { TelegramConnectButton, TelegramConnectButtonProps } from './components/telegram-connect-button/TelegramConnectButton.cjs';
|
|
18
|
+
export { UseAgentChatProps, UseAgentChatResult, useAgentChat } from './hooks/useAgentChat.cjs';
|
|
18
19
|
export { UseChannelConnectionProps, UseChannelConnectionResult, useChannelConnection } from './hooks/useChannelConnection.cjs';
|
|
19
20
|
export { UseChannelConnectionsProps, UseChannelConnectionsResult, useChannelConnections } from './hooks/useChannelConnections.cjs';
|
|
20
21
|
export { UseChannelEndpointProps, UseChannelEndpointResult, useChannelEndpoint } from './hooks/useChannelEndpoint.cjs';
|
|
@@ -37,6 +37,7 @@ __export(server_exports, {
|
|
|
37
37
|
SubscriptionPreferences: () => SubscriptionPreferences,
|
|
38
38
|
TelegramConnectButton: () => TelegramConnectButton,
|
|
39
39
|
WorkflowCriticalityEnum: () => import_js.WorkflowCriticalityEnum,
|
|
40
|
+
useAgentChat: () => useAgentChat,
|
|
40
41
|
useCounts: () => useCounts,
|
|
41
42
|
useCreateSubscription: () => useCreateSubscription,
|
|
42
43
|
useNotifications: () => useNotifications,
|
|
@@ -91,6 +92,23 @@ function TelegramConnectButton() {
|
|
|
91
92
|
function useNovu() {
|
|
92
93
|
return null;
|
|
93
94
|
}
|
|
95
|
+
function useAgentChat(_) {
|
|
96
|
+
return {
|
|
97
|
+
messages: [],
|
|
98
|
+
pendingActions: [],
|
|
99
|
+
isLoading: false,
|
|
100
|
+
isFetching: false,
|
|
101
|
+
isRunning: false,
|
|
102
|
+
typing: void 0,
|
|
103
|
+
status: "active",
|
|
104
|
+
hasMore: false,
|
|
105
|
+
refetch: () => Promise.resolve(),
|
|
106
|
+
fetchMore: () => Promise.resolve({ data: void 0, error: void 0 }),
|
|
107
|
+
sendMessage: () => Promise.resolve({ data: void 0, error: void 0 }),
|
|
108
|
+
respondToAction: () => Promise.resolve({ data: void 0, error: void 0 }),
|
|
109
|
+
sendAction: () => Promise.resolve({ data: void 0, error: void 0 })
|
|
110
|
+
};
|
|
111
|
+
}
|
|
94
112
|
function useCounts(_) {
|
|
95
113
|
return {
|
|
96
114
|
isLoading: false,
|
|
@@ -179,6 +197,7 @@ function useSubscriptions(_) {
|
|
|
179
197
|
SubscriptionPreferences,
|
|
180
198
|
TelegramConnectButton,
|
|
181
199
|
WorkflowCriticalityEnum,
|
|
200
|
+
useAgentChat,
|
|
182
201
|
useCounts,
|
|
183
202
|
useCreateSubscription,
|
|
184
203
|
useNotifications,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type { InboxProps } from '../components/Inbox';\nimport { ShadowRootDetector } from '../components/ShadowRootDetector';\nimport type {\n UseCreateSubscriptionProps,\n UseCreateSubscriptionResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesProps,\n UsePreferencesResult,\n UseRemoveSubscriptionProps,\n UseRemoveSubscriptionResult,\n UseScheduleProps,\n UseScheduleResult,\n UseSubscriptionProps,\n UseSubscriptionResult,\n UseSubscriptionsProps,\n UseSubscriptionsResult,\n UseUpdateSubscriptionProps,\n UseUpdateSubscriptionResult,\n} from '../hooks';\nimport type { NovuProviderProps } from '../hooks/NovuProvider';\nimport type { UseCountsProps, UseCountsResult } from '../hooks/useCounts';\n\n/**\n * Exporting all components from the components folder\n * as empty functions to fix build errors in SSR\n * This will be replaced with actual components\n * when we implement the SSR components in @novu/js/ui\n */\nexport function Inbox(props: InboxProps) {\n return <ShadowRootDetector />;\n}\n\nexport function InboxContent() {}\n\nexport function Notifications() {}\n\nexport function Preferences() {}\n\nexport function Bell() {}\n\nexport function NovuProvider(props: NovuProviderProps) {\n return <>{props.children}</>;\n}\n\nexport function Subscription() {\n return <ShadowRootDetector />;\n}\n\nexport function SubscriptionButton() {}\n\nexport function SubscriptionPreferences() {}\n\nexport function SlackConnectButton() {\n return <ShadowRootDetector />;\n}\n\nexport function SlackLinkUser() {\n return <ShadowRootDetector />;\n}\n\nexport function MsTeamsConnectButton() {\n return <ShadowRootDetector />;\n}\n\nexport function MsTeamsLinkUser() {\n return <ShadowRootDetector />;\n}\n\nexport function TelegramConnectButton() {\n return <ShadowRootDetector />;\n}\n\nexport function useNovu() {\n return null;\n}\n\nexport function useCounts(_: UseCountsProps): UseCountsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useNotifications(_: UseNotificationsProps): UseNotificationsResult {\n return {\n isLoading: false,\n isFetching: false,\n hasMore: false,\n readAll: () => Promise.resolve({ data: undefined, error: undefined }),\n seenAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAllRead: () => Promise.resolve({ data: undefined, error: undefined }),\n refetch: () => Promise.resolve(),\n fetchMore: () => Promise.resolve(),\n };\n}\n\nexport function usePreferences(_: UsePreferencesProps): UsePreferencesResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useSchedule(_: UseScheduleProps): UseScheduleResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useSubscription(_: UseSubscriptionProps): UseSubscriptionResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useCreateSubscription(_: UseCreateSubscriptionProps = {}): UseCreateSubscriptionResult {\n return {\n isCreating: false,\n error: undefined,\n create: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useUpdateSubscription(_: UseUpdateSubscriptionProps = {}): UseUpdateSubscriptionResult {\n return {\n isUpdating: false,\n error: undefined,\n update: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useRemoveSubscription(_: UseRemoveSubscriptionProps = {}): UseRemoveSubscriptionResult {\n return {\n isRemoving: false,\n error: undefined,\n remove: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useSubscriptions(_: UseSubscriptionsProps): UseSubscriptionsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport type * from '@novu/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';\n\nexport type {\n AllLocalization,\n AllLocalizationKey,\n ElementStyles,\n InboxAppearance,\n InboxAppearanceCallback,\n InboxAppearanceCallbackFunction,\n InboxAppearanceCallbackKeys,\n InboxAppearanceKey,\n InboxElements,\n InboxLocalization,\n InboxLocalizationKey,\n InboxTheme,\n NotificationActionClickHandler,\n NotificationClickHandler,\n NotificationRenderer,\n PreferenceGroups,\n PreferencesFilter,\n RouterPush,\n SubscriptionAppearance,\n SubscriptionAppearanceCallback,\n SubscriptionAppearanceCallbackFunction,\n SubscriptionAppearanceCallbackKeys,\n SubscriptionAppearanceKey,\n SubscriptionElements,\n SubscriptionLocalization,\n SubscriptionLocalizationKey,\n SubscriptionTheme,\n Tab,\n Variables,\n} from '@novu/js/ui';\n\nexport type { BellProps, InboxContentProps, InboxProps, NotificationProps, NovuProviderProps } from '../components';\n\nexport type {\n UseCountsProps,\n UseCountsResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n} from '../hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\n SubjectBodyRendererProps,\n SubjectRenderer,\n WithChildrenProps,\n} from '../utils/types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gCAAmC;
|
|
1
|
+
{"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type { InboxProps } from '../components/Inbox';\nimport { ShadowRootDetector } from '../components/ShadowRootDetector';\nimport type {\n UseAgentChatProps,\n UseAgentChatResult,\n UseCreateSubscriptionProps,\n UseCreateSubscriptionResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesProps,\n UsePreferencesResult,\n UseRemoveSubscriptionProps,\n UseRemoveSubscriptionResult,\n UseScheduleProps,\n UseScheduleResult,\n UseSubscriptionProps,\n UseSubscriptionResult,\n UseSubscriptionsProps,\n UseSubscriptionsResult,\n UseUpdateSubscriptionProps,\n UseUpdateSubscriptionResult,\n} from '../hooks';\nimport type { NovuProviderProps } from '../hooks/NovuProvider';\nimport type { UseCountsProps, UseCountsResult } from '../hooks/useCounts';\n\n/**\n * Exporting all components from the components folder\n * as empty functions to fix build errors in SSR\n * This will be replaced with actual components\n * when we implement the SSR components in @novu/js/ui\n */\nexport function Inbox(props: InboxProps) {\n return <ShadowRootDetector />;\n}\n\nexport function InboxContent() {}\n\nexport function Notifications() {}\n\nexport function Preferences() {}\n\nexport function Bell() {}\n\nexport function NovuProvider(props: NovuProviderProps) {\n return <>{props.children}</>;\n}\n\nexport function Subscription() {\n return <ShadowRootDetector />;\n}\n\nexport function SubscriptionButton() {}\n\nexport function SubscriptionPreferences() {}\n\nexport function SlackConnectButton() {\n return <ShadowRootDetector />;\n}\n\nexport function SlackLinkUser() {\n return <ShadowRootDetector />;\n}\n\nexport function MsTeamsConnectButton() {\n return <ShadowRootDetector />;\n}\n\nexport function MsTeamsLinkUser() {\n return <ShadowRootDetector />;\n}\n\nexport function TelegramConnectButton() {\n return <ShadowRootDetector />;\n}\n\nexport function useNovu() {\n return null;\n}\n\nexport function useAgentChat(_: UseAgentChatProps): UseAgentChatResult {\n return {\n messages: [],\n pendingActions: [],\n isLoading: false,\n isFetching: false,\n isRunning: false,\n typing: undefined,\n status: 'active',\n hasMore: false,\n refetch: () => Promise.resolve(),\n fetchMore: () => Promise.resolve({ data: undefined, error: undefined }),\n sendMessage: () => Promise.resolve({ data: undefined, error: undefined }),\n respondToAction: () => Promise.resolve({ data: undefined, error: undefined }),\n sendAction: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useCounts(_: UseCountsProps): UseCountsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useNotifications(_: UseNotificationsProps): UseNotificationsResult {\n return {\n isLoading: false,\n isFetching: false,\n hasMore: false,\n readAll: () => Promise.resolve({ data: undefined, error: undefined }),\n seenAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAll: () => Promise.resolve({ data: undefined, error: undefined }),\n archiveAllRead: () => Promise.resolve({ data: undefined, error: undefined }),\n refetch: () => Promise.resolve(),\n fetchMore: () => Promise.resolve(),\n };\n}\n\nexport function usePreferences(_: UsePreferencesProps): UsePreferencesResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useSchedule(_: UseScheduleProps): UseScheduleResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useSubscription(_: UseSubscriptionProps): UseSubscriptionResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport function useCreateSubscription(_: UseCreateSubscriptionProps = {}): UseCreateSubscriptionResult {\n return {\n isCreating: false,\n error: undefined,\n create: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useUpdateSubscription(_: UseUpdateSubscriptionProps = {}): UseUpdateSubscriptionResult {\n return {\n isUpdating: false,\n error: undefined,\n update: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useRemoveSubscription(_: UseRemoveSubscriptionProps = {}): UseRemoveSubscriptionResult {\n return {\n isRemoving: false,\n error: undefined,\n remove: () => Promise.resolve({ data: undefined, error: undefined }),\n };\n}\n\nexport function useSubscriptions(_: UseSubscriptionsProps): UseSubscriptionsResult {\n return {\n isLoading: false,\n isFetching: false,\n refetch: () => Promise.resolve(),\n };\n}\n\nexport type * from '@novu/js';\nexport { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';\n\nexport type {\n AllLocalization,\n AllLocalizationKey,\n ElementStyles,\n InboxAppearance,\n InboxAppearanceCallback,\n InboxAppearanceCallbackFunction,\n InboxAppearanceCallbackKeys,\n InboxAppearanceKey,\n InboxElements,\n InboxLocalization,\n InboxLocalizationKey,\n InboxTheme,\n NotificationActionClickHandler,\n NotificationClickHandler,\n NotificationRenderer,\n PreferenceGroups,\n PreferencesFilter,\n RouterPush,\n SubscriptionAppearance,\n SubscriptionAppearanceCallback,\n SubscriptionAppearanceCallbackFunction,\n SubscriptionAppearanceCallbackKeys,\n SubscriptionAppearanceKey,\n SubscriptionElements,\n SubscriptionLocalization,\n SubscriptionLocalizationKey,\n SubscriptionTheme,\n Tab,\n Variables,\n} from '@novu/js/ui';\n\nexport type { BellProps, InboxContentProps, InboxProps, NotificationProps, NovuProviderProps } from '../components';\n\nexport type {\n UseAgentChatProps,\n UseAgentChatResult,\n UseCountsProps,\n UseCountsResult,\n UseNotificationsProps,\n UseNotificationsResult,\n UsePreferencesResult,\n UseScheduleProps as UsePreferencesProps,\n} from '../hooks';\n\nexport type {\n BaseProps,\n BellRenderer,\n BodyRenderer,\n DefaultInboxProps,\n DefaultProps,\n NoRendererProps,\n NotificationRendererProps,\n NotificationsRenderer,\n SubjectBodyRendererProps,\n SubjectRenderer,\n WithChildrenProps,\n} from '../utils/types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gCAAmC;AA+KnC,gBAA4E;AAhJnE;AADF,SAAS,MAAM,OAAmB;AACvC,SAAO,4CAAC,gDAAmB;AAC7B;AAEO,SAAS,eAAe;AAAC;AAEzB,SAAS,gBAAgB;AAAC;AAE1B,SAAS,cAAc;AAAC;AAExB,SAAS,OAAO;AAAC;AAEjB,S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