@novu/react 3.19.1 → 3.19.2-rc.dc9caee828

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.
@@ -25,6 +25,7 @@ __export(hooks_exports, {
25
25
  PreferenceLevel: () => import_js.PreferenceLevel,
26
26
  SeverityLevelEnum: () => import_js.SeverityLevelEnum,
27
27
  WorkflowCriticalityEnum: () => import_js.WorkflowCriticalityEnum,
28
+ pendingActionKey: () => import_js.pendingActionKey,
28
29
  useNovu: () => import_NovuProvider.useNovu
29
30
  });
30
31
  module.exports = __toCommonJS(hooks_exports);
@@ -54,6 +55,7 @@ __reExport(hooks_exports, require("./useUpdateSubscription.cjs"), module.exports
54
55
  PreferenceLevel,
55
56
  SeverityLevelEnum,
56
57
  WorkflowCriticalityEnum,
58
+ pendingActionKey,
57
59
  useNovu,
58
60
  ...require("./useWebChat.cjs"),
59
61
  ...require("./useChannelConnection.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 './useWebChat';\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,6BAHd;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
+ {"version":3,"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export type * from '@novu/js';\nexport { pendingActionKey, PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';\nexport { NovuProvider, useNovu } from './NovuProvider';\nexport * from './useWebChat';\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;AAAA;AACA,gBAA8F;AAC9F,0BAAsC;AACtC,0BAAc,6BAHd;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,5 +1,5 @@
1
1
  export * from '@novu/js';
2
- export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';
2
+ export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum, pendingActionKey } from '@novu/js';
3
3
  export { NovuProvider, useNovu } from './NovuProvider.cjs';
4
4
  export { UseWebChatProps, UseWebChatResult, useWebChat } from './useWebChat.cjs';
5
5
  export { UseChannelConnectionProps, UseChannelConnectionResult, useChannelConnection } from './useChannelConnection.cjs';
@@ -92,16 +92,11 @@ function handlePublicationCallbacks(args) {
92
92
  function getCreateFlowKey(agentId, agentHash) {
93
93
  return `${agentId}\0${agentHash ?? ""}`;
94
94
  }
95
- function resolveOwnedRuntime(args) {
96
- const key = getCreateFlowKey(args.agentId, args.agentHash);
97
- const current = args.ownedRuntimeRef.current;
98
- if ((current == null ? void 0 : current.novu) === args.novu && current.key === key) {
99
- return current.runtime;
95
+ function getManagedRuntimeKey(agentId, agentHash, conversationIdProp, createEpoch) {
96
+ if (conversationIdProp) {
97
+ return `resume:${agentId}\0${agentHash ?? ""}\0${conversationIdProp}`;
100
98
  }
101
- current == null ? void 0 : current.runtime.dispose();
102
- const runtime = args.novu.webChat.conversation({ agentId: args.agentId, agentHash: args.agentHash });
103
- args.ownedRuntimeRef.current = { key, novu: args.novu, runtime };
104
- return runtime;
99
+ return `${getCreateFlowKey(agentId, agentHash)}\0${createEpoch}`;
105
100
  }
106
101
  function toNovuError(error) {
107
102
  if (error instanceof import_js.NovuError) {
@@ -113,7 +108,6 @@ function toNovuError(error) {
113
108
  return new import_js.NovuError("Failed to load Web Chat", new Error(String(error)));
114
109
  }
115
110
  var useWebChat = (props) => {
116
- var _a;
117
111
  const novu = (0, import_NovuProvider.useNovu)();
118
112
  const propsRef = (0, import_useDataRef.useDataRef)(props);
119
113
  const [loadState, setLoadState] = (0, import_react.useState)(() => ({
@@ -130,12 +124,12 @@ var useWebChat = (props) => {
130
124
  setLoadState({ novu, status: "ready" });
131
125
  }
132
126
  }).catch((error) => {
133
- var _a2, _b;
127
+ var _a, _b;
134
128
  if (cancelled) {
135
129
  return;
136
130
  }
137
131
  const novuError = toNovuError(error);
138
- (_b = (_a2 = propsRef.current).onError) == null ? void 0 : _b.call(_a2, novuError);
132
+ (_b = (_a = propsRef.current).onError) == null ? void 0 : _b.call(_a, novuError);
139
133
  setLoadState({ novu, status: "error", error: novuError });
140
134
  });
141
135
  return () => {
@@ -150,42 +144,40 @@ var useWebChat = (props) => {
150
144
  const conversationIdProp = sharedRuntime ? void 0 : props.conversationId;
151
145
  const agentHash = sharedRuntime ? void 0 : props.agentHash;
152
146
  const ownedRuntimeRef = (0, import_react.useRef)(null);
147
+ const [managedRuntime, setManagedRuntime] = (0, import_react.useState)(null);
148
+ const [createEpoch, setCreateEpoch] = (0, import_react.useState)(0);
149
+ const managedRuntimeKey = sharedRuntime ? null : getManagedRuntimeKey(agentId, agentHash, conversationIdProp, createEpoch);
153
150
  (0, import_react.useEffect)(() => {
154
- const current = ownedRuntimeRef.current;
155
- if (current && current.novu !== novu) {
156
- current.runtime.dispose();
151
+ var _a;
152
+ if (sharedRuntime) {
153
+ (_a = ownedRuntimeRef.current) == null ? void 0 : _a.runtime.dispose();
157
154
  ownedRuntimeRef.current = null;
155
+ setManagedRuntime(null);
156
+ return;
158
157
  }
159
- }, [novu]);
160
- const cachedRuntime = (0, import_react.useMemo)(() => {
161
- if (!webChatReady) {
162
- return null;
163
- }
164
- if (sharedRuntime) {
165
- return sharedRuntime;
158
+ if (!webChatReady || !managedRuntimeKey) {
159
+ setManagedRuntime(null);
160
+ return;
166
161
  }
167
- if (!conversationIdProp) {
168
- return null;
162
+ const key = managedRuntimeKey;
163
+ const current = ownedRuntimeRef.current;
164
+ let runtime2;
165
+ if ((current == null ? void 0 : current.novu) === novu && current.key === key) {
166
+ runtime2 = current.runtime;
167
+ } else {
168
+ current == null ? void 0 : current.runtime.dispose();
169
+ runtime2 = conversationIdProp ? novu.webChat.conversation({ agentId, conversationId: conversationIdProp, agentHash }) : novu.webChat.conversation({ agentId, agentHash });
170
+ ownedRuntimeRef.current = { key, novu, runtime: runtime2 };
169
171
  }
170
- return novu.webChat.conversation({
171
- agentId,
172
- conversationId: conversationIdProp,
173
- agentHash
174
- });
175
- }, [webChatReady, sharedRuntime, novu, agentId, conversationIdProp, agentHash]);
176
- if (sharedRuntime || conversationIdProp) {
177
- (_a = ownedRuntimeRef.current) == null ? void 0 : _a.runtime.dispose();
178
- ownedRuntimeRef.current = null;
179
- }
180
- const ownedRuntime = !webChatReady || sharedRuntime || conversationIdProp ? null : resolveOwnedRuntime({ novu, agentId, agentHash, ownedRuntimeRef });
181
- const runtime = sharedRuntime ?? cachedRuntime ?? ownedRuntime;
182
- (0, import_react.useEffect)(() => {
172
+ setManagedRuntime({ key, runtime: runtime2 });
183
173
  return () => {
184
174
  var _a2;
185
175
  (_a2 = ownedRuntimeRef.current) == null ? void 0 : _a2.runtime.dispose();
186
176
  ownedRuntimeRef.current = null;
177
+ setManagedRuntime(null);
187
178
  };
188
- }, []);
179
+ }, [webChatReady, sharedRuntime, novu, agentId, conversationIdProp, agentHash, createEpoch, managedRuntimeKey]);
180
+ const runtime = sharedRuntime ?? ((managedRuntime == null ? void 0 : managedRuntime.key) === managedRuntimeKey ? managedRuntime.runtime : null);
189
181
  const loadNotifiedRef = (0, import_react.useRef)(false);
190
182
  const replayedActionsRef = (0, import_react.useRef)(false);
191
183
  const notifiedCatchUpErrorRef = (0, import_react.useRef)();
@@ -198,7 +190,7 @@ var useWebChat = (props) => {
198
190
  }, [runtime]);
199
191
  const subscribe = (0, import_react.useCallback)(
200
192
  (onStoreChange) => {
201
- var _a2, _b;
193
+ var _a, _b;
202
194
  if (!runtime) {
203
195
  return () => {
204
196
  };
@@ -206,7 +198,7 @@ var useWebChat = (props) => {
206
198
  if (!replayedActionsRef.current) {
207
199
  replayedActionsRef.current = true;
208
200
  for (const action of runtime.getSnapshot().pendingActions) {
209
- (_b = (_a2 = propsRef.current).onActionRequested) == null ? void 0 : _b.call(_a2, action);
201
+ (_b = (_a = propsRef.current).onActionRequested) == null ? void 0 : _b.call(_a, action);
210
202
  }
211
203
  }
212
204
  return runtime.subscribe((snapshot2, meta) => {
@@ -233,13 +225,13 @@ var useWebChat = (props) => {
233
225
  const snapshot = (0, import_react.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
234
226
  const callRuntime = (0, import_react.useCallback)(
235
227
  async (action) => {
236
- var _a2, _b, _c, _d;
228
+ var _a, _b, _c, _d;
237
229
  if (!runtime) {
238
230
  const error = webChatLoadError ?? new import_js.NovuError(
239
231
  isWebChatLoading ? "Web Chat is still loading" : "Web Chat runtime is unavailable",
240
232
  new Error("Web Chat runtime is not ready")
241
233
  );
242
- (_b = (_a2 = propsRef.current).onError) == null ? void 0 : _b.call(_a2, error);
234
+ (_b = (_a = propsRef.current).onError) == null ? void 0 : _b.call(_a, error);
243
235
  return { error };
244
236
  }
245
237
  const response = await action(runtime);
@@ -251,13 +243,13 @@ var useWebChat = (props) => {
251
243
  [runtime, webChatLoadError, isWebChatLoading, propsRef]
252
244
  );
253
245
  const refetch = (0, import_react.useCallback)(async () => {
254
- var _a2, _b;
246
+ var _a, _b;
255
247
  if (!runtime) {
256
248
  return;
257
249
  }
258
250
  const response = await runtime.load();
259
251
  if (response.data) {
260
- (_b = (_a2 = propsRef.current).onSuccess) == null ? void 0 : _b.call(_a2, {
252
+ (_b = (_a = propsRef.current).onSuccess) == null ? void 0 : _b.call(_a, {
261
253
  conversationId: response.data.conversationId,
262
254
  messages: [...response.data.messages],
263
255
  hasMore: response.data.hasMore
@@ -299,6 +291,12 @@ var useWebChat = (props) => {
299
291
  (messageId) => callRuntime((target) => target.retryMessage(messageId)),
300
292
  [callRuntime]
301
293
  );
294
+ const startNewConversation = (0, import_react.useCallback)(() => {
295
+ if (sharedRuntime || conversationIdProp) {
296
+ return;
297
+ }
298
+ setCreateEpoch((epoch) => epoch + 1);
299
+ }, [sharedRuntime, conversationIdProp]);
302
300
  return {
303
301
  messages: [...snapshot.messages],
304
302
  pendingActions: [...snapshot.pendingActions],
@@ -316,7 +314,8 @@ var useWebChat = (props) => {
316
314
  sendMessage,
317
315
  respondToAction,
318
316
  sendAction,
319
- retryMessage
317
+ retryMessage,
318
+ startNewConversation
320
319
  };
321
320
  };
322
321
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/useWebChat.ts"],"sourcesContent":["import type {\n AgentConversationPublicationMeta,\n AgentConversationRunSnapshot,\n AgentConversationRuntime,\n AgentConversationSnapshot,\n AgentConversationStatus,\n AgentEventEnvelope,\n AgentHashFields,\n AgentMessage,\n AgentPendingAction,\n AgentToolApprovalDecision,\n LoadConversationResult,\n RespondToActionResult,\n SendActionResult,\n SendMessageInput,\n SendMessageResult,\n WebChatPagination,\n WebChatPlanLimitError,\n} from '@novu/js';\nimport { NovuError } from '@novu/js';\nimport { type MutableRefObject, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport { useDataRef } from './internal/useDataRef';\nimport { useNovu } from './NovuProvider';\n\ntype UseWebChatCallbacks = {\n onSuccess?: (data: LoadConversationResult) => void;\n onError?: (error: NovuError | WebChatPlanLimitError) => void;\n /**\n * Fires once when a message id first appears. History pages do not fire.\n * The first event of a turn can create an empty assistant message before text arrives.\n * A send that never reaches the server does not fire. The message status becomes `failed` instead.\n */\n onMessage?: (message: AgentMessage) => void;\n /**\n * Fires once per pending action, including actions still pending on mount.\n * Paging backwards does not fire.\n */\n onActionRequested?: (action: AgentPendingAction) => void;\n /**\n * Live event envelopes for this conversation.\n * Duplicates that the client drops do not fire.\n * Envelopes that arrive before the conversation id exists do not fire.\n * The message list in this render does not include this envelope yet.\n */\n onEvent?: (envelope: AgentEventEnvelope) => void;\n};\n\n/** Arguments for {@link useWebChat}. Pass `agentId`, or pass `conversation`. Do not mix the two. */\nexport type UseWebChatProps = UseWebChatCallbacks &\n AgentHashFields &\n (\n | {\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 */\n conversationId?: string;\n conversation?: never;\n }\n | {\n /** Share an existing conversation runtime across multiple hook instances. */\n conversation: AgentConversationRuntime;\n agentId?: never;\n conversationId?: never;\n agentHash?: never;\n }\n );\n\n/** State and actions returned by {@link useWebChat}. */\nexport type UseWebChatResult = {\n /** Conversation timeline. */\n messages: AgentMessage[];\n /** Tool approvals and MCP connect items that are still pending. */\n pendingActions: AgentPendingAction[];\n /** Server conversation id after create or resume. */\n conversationId?: string;\n /** Last error from load, send, retry, or action. */\n error?: NovuError | WebChatPlanLimitError;\n /** True while Web Chat loads and, for an existing conversation, until the first history fetch completes. */\n isLoading: boolean;\n /** True while the agent turn is in progress. Same as `run.isRunning`. */\n isRunning: boolean;\n /** Typing indicator. Same as `run.typing`. Absent when the agent is not typing. */\n typing?: AgentConversationRunSnapshot['typing'];\n /** `'active'` or `'resolved'`. The agent sets `resolved` with `ctx.resolve()`. Not a loading flag. */\n conversationStatus: AgentConversationStatus;\n /** Current agent-run snapshot. */\n run: AgentConversationRunSnapshot;\n /** Older-history control. Not a top-level `hasMore` or `fetchMore`. */\n pagination: WebChatPagination & {\n fetchMore: () => Promise<{\n data?: { messages: AgentMessage[]; hasMore: boolean };\n error?: NovuError;\n }>;\n };\n /** True while reconnect recovery is in progress. */\n isRecovering: boolean;\n /** Set when reconnect recovery fails. Separate from send and fetch `error`. */\n catchUpError?: NovuError;\n /** Reload the newest history page. No-op when there is no conversation id. */\n refetch: () => Promise<void>;\n /** Send a user message. `input` is a string, or `{ text, metadata }`. Creates a conversation when `conversationId` is omitted. */\n sendMessage: (input: SendMessageInput) => Promise<{\n data?: SendMessageResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /** Resolve a pending `tool-approval`. Pass `action.id` from `pendingActions`. */\n respondToAction: (args: { actionId: string; decision: AgentToolApprovalDecision }) => Promise<{\n data?: RespondToActionResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /** Click a Card button. Do not use this for tool approval. */\n sendAction: (args: { actionId: string; sourceMessageId: string; value?: string }) => Promise<{\n data?: SendActionResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /** Resend a message whose `status` is `failed`. Reuses the original idempotency key. */\n retryMessage: (messageId: string) => Promise<{\n data?: SendMessageResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n};\n\nconst EMPTY_SERVER_SNAPSHOT = {\n key: 'ssr',\n status: 'loading',\n run: { isRunning: false },\n conversationStatus: 'active',\n pagination: { hasMore: false, status: 'idle' },\n messages: [],\n pendingActions: [],\n isRecovering: false,\n} as AgentConversationSnapshot;\n\ntype RuntimeActionResult<T> = {\n data?: T;\n error?: NovuError | WebChatPlanLimitError;\n};\n\nfunction handlePublicationCallbacks(args: {\n snapshot: AgentConversationSnapshot;\n meta: AgentConversationPublicationMeta | undefined;\n conversationIdProp: string | undefined;\n propsRef: ReturnType<typeof useDataRef<UseWebChatProps>>;\n loadNotifiedRef: MutableRefObject<boolean>;\n notifiedCatchUpErrorRef: MutableRefObject<NovuError | undefined>;\n lastReportedErrorKeyRef: MutableRefObject<string | undefined>;\n}): void {\n const {\n snapshot,\n meta,\n conversationIdProp,\n propsRef,\n loadNotifiedRef,\n notifiedCatchUpErrorRef,\n lastReportedErrorKeyRef,\n } = args;\n\n if ((meta?.historyLoaded || meta?.change?.kind === 'history') && !loadNotifiedRef.current && conversationIdProp) {\n if (snapshot.conversationId) {\n loadNotifiedRef.current = true;\n propsRef.current.onSuccess?.({\n conversationId: snapshot.conversationId,\n messages: [...snapshot.messages],\n hasMore: snapshot.pagination.hasMore,\n });\n }\n }\n\n if (snapshot.catchUpError && snapshot.catchUpError !== notifiedCatchUpErrorRef.current) {\n notifiedCatchUpErrorRef.current = snapshot.catchUpError;\n propsRef.current.onError?.(snapshot.catchUpError);\n } else if (!snapshot.catchUpError) {\n notifiedCatchUpErrorRef.current = undefined;\n }\n\n if (snapshot.error) {\n const originalMessage = 'originalError' in snapshot.error ? (snapshot.error.originalError?.message ?? '') : '';\n const errorKey = `${snapshot.error.message}:${originalMessage}`;\n if (lastReportedErrorKeyRef.current !== errorKey) {\n lastReportedErrorKeyRef.current = errorKey;\n propsRef.current.onError?.(snapshot.error as NovuError | WebChatPlanLimitError);\n }\n } else {\n lastReportedErrorKeyRef.current = undefined;\n }\n\n const change = meta?.change;\n if (change?.kind === 'live') {\n propsRef.current.onEvent?.(change.envelope);\n }\n\n if (change && change.kind !== 'history') {\n for (const message of change.addedMessages) {\n propsRef.current.onMessage?.(message);\n }\n }\n\n if (change) {\n for (const action of change.newActions) {\n propsRef.current.onActionRequested?.(action);\n }\n }\n}\n\ntype OwnedRuntimeEntry = {\n key: string;\n novu: ReturnType<typeof useNovu>;\n runtime: AgentConversationRuntime;\n};\n\nfunction getCreateFlowKey(agentId: string, agentHash?: string): string {\n return `${agentId}\\0${agentHash ?? ''}`;\n}\n\nfunction resolveOwnedRuntime(args: {\n novu: ReturnType<typeof useNovu>;\n agentId: string;\n agentHash?: string;\n ownedRuntimeRef: MutableRefObject<OwnedRuntimeEntry | null>;\n}): AgentConversationRuntime | null {\n const key = getCreateFlowKey(args.agentId, args.agentHash);\n const current = args.ownedRuntimeRef.current;\n\n if (current?.novu === args.novu && current.key === key) {\n return current.runtime;\n }\n\n current?.runtime.dispose();\n\n const runtime = args.novu.webChat.conversation({ agentId: args.agentId, agentHash: args.agentHash });\n args.ownedRuntimeRef.current = { key, novu: args.novu, runtime };\n return runtime;\n}\n\ntype WebChatLoadState =\n | { novu: ReturnType<typeof useNovu>; status: 'loading' }\n | { novu: ReturnType<typeof useNovu>; status: 'ready' }\n | { novu: ReturnType<typeof useNovu>; status: 'error'; error: NovuError };\n\nfunction toNovuError(error: unknown): NovuError {\n if (error instanceof NovuError) {\n return error;\n }\n\n if (error instanceof Error) {\n return new NovuError('Failed to load Web Chat', error);\n }\n\n return new NovuError('Failed to load Web Chat', new Error(String(error)));\n}\n\n/**\n * Headless Web Chat client. Use it inside `NovuProvider`.\n *\n * @example\n * ```tsx\n * const { messages, sendMessage, isRunning, isLoading, error } = useWebChat({\n * agentId: 'YOUR_AGENT_IDENTIFIER',\n * });\n * ```\n */\nexport const useWebChat = (props: UseWebChatProps): UseWebChatResult => {\n const novu = useNovu();\n const propsRef = useDataRef(props);\n const [loadState, setLoadState] = useState<WebChatLoadState>(() => ({\n novu,\n status: 'loading',\n }));\n\n useEffect(() => {\n let cancelled = false;\n\n if (!novu.isWebChatLoaded) {\n setLoadState({ novu, status: 'loading' });\n }\n\n void novu\n .loadWebChat()\n .then(() => {\n if (!cancelled) {\n setLoadState({ novu, status: 'ready' });\n }\n })\n .catch((error: unknown) => {\n if (cancelled) {\n return;\n }\n\n const novuError = toNovuError(error);\n propsRef.current.onError?.(novuError);\n setLoadState({ novu, status: 'error', error: novuError });\n });\n\n return () => {\n cancelled = true;\n };\n }, [novu, propsRef]);\n\n const webChatReady = loadState.novu === novu && loadState.status === 'ready';\n const webChatLoadError = loadState.novu === novu && loadState.status === 'error' ? loadState.error : undefined;\n const isWebChatLoading = loadState.novu !== novu || loadState.status === 'loading';\n\n const sharedRuntime = 'conversation' in props ? props.conversation : undefined;\n const agentId = sharedRuntime?.agentId ?? props.agentId!;\n const conversationIdProp = sharedRuntime ? undefined : props.conversationId;\n const agentHash = sharedRuntime ? undefined : props.agentHash;\n\n const ownedRuntimeRef = useRef<OwnedRuntimeEntry | null>(null);\n\n useEffect(() => {\n const current = ownedRuntimeRef.current;\n if (current && current.novu !== novu) {\n current.runtime.dispose();\n ownedRuntimeRef.current = null;\n }\n }, [novu]);\n\n const cachedRuntime = useMemo(() => {\n if (!webChatReady) {\n return null;\n }\n\n if (sharedRuntime) {\n return sharedRuntime;\n }\n\n if (!conversationIdProp) {\n return null;\n }\n\n return novu.webChat.conversation({\n agentId,\n conversationId: conversationIdProp,\n agentHash,\n });\n }, [webChatReady, sharedRuntime, novu, agentId, conversationIdProp, agentHash]);\n\n if (sharedRuntime || conversationIdProp) {\n ownedRuntimeRef.current?.runtime.dispose();\n ownedRuntimeRef.current = null;\n }\n\n const ownedRuntime =\n !webChatReady || sharedRuntime || conversationIdProp\n ? null\n : resolveOwnedRuntime({ novu, agentId, agentHash, ownedRuntimeRef });\n\n const runtime = sharedRuntime ?? cachedRuntime ?? ownedRuntime;\n\n useEffect(() => {\n return () => {\n ownedRuntimeRef.current?.runtime.dispose();\n ownedRuntimeRef.current = null;\n };\n }, []);\n\n const loadNotifiedRef = useRef(false);\n const replayedActionsRef = useRef(false);\n const notifiedCatchUpErrorRef = useRef<NovuError | undefined>();\n const lastReportedErrorKeyRef = useRef<string>();\n\n useEffect(() => {\n loadNotifiedRef.current = false;\n replayedActionsRef.current = false;\n notifiedCatchUpErrorRef.current = undefined;\n lastReportedErrorKeyRef.current = undefined;\n }, [runtime]);\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n if (!runtime) {\n return () => {};\n }\n\n if (!replayedActionsRef.current) {\n replayedActionsRef.current = true;\n for (const action of runtime.getSnapshot().pendingActions) {\n propsRef.current.onActionRequested?.(action);\n }\n }\n\n return runtime.subscribe((snapshot, meta) => {\n onStoreChange();\n handlePublicationCallbacks({\n snapshot,\n meta,\n conversationIdProp,\n propsRef,\n loadNotifiedRef,\n notifiedCatchUpErrorRef,\n lastReportedErrorKeyRef,\n });\n });\n },\n [runtime, conversationIdProp, propsRef]\n );\n\n const getSnapshot = useCallback(() => {\n return runtime?.getSnapshot() ?? EMPTY_SERVER_SNAPSHOT;\n }, [runtime]);\n\n const getServerSnapshot = useCallback(() => {\n return runtime?.getServerSnapshot() ?? EMPTY_SERVER_SNAPSHOT;\n }, [runtime]);\n\n const snapshot = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n\n const callRuntime = useCallback(\n async <T>(action: (target: AgentConversationRuntime) => Promise<RuntimeActionResult<T>>) => {\n if (!runtime) {\n const error =\n webChatLoadError ??\n new NovuError(\n isWebChatLoading ? 'Web Chat is still loading' : 'Web Chat runtime is unavailable',\n new Error('Web Chat runtime is not ready')\n );\n propsRef.current.onError?.(error);\n\n return { error };\n }\n\n const response = await action(runtime);\n if (response.error) {\n propsRef.current.onError?.(response.error);\n }\n\n return response;\n },\n [runtime, webChatLoadError, isWebChatLoading, propsRef]\n );\n\n const refetch = useCallback(async () => {\n if (!runtime) {\n return;\n }\n\n const response = await runtime.load();\n if (response.data) {\n propsRef.current.onSuccess?.({\n conversationId: response.data.conversationId,\n messages: [...response.data.messages],\n hasMore: response.data.hasMore,\n });\n }\n }, [runtime, propsRef]);\n\n const fetchMore = useCallback(async () => {\n const response = await callRuntime((target) => target.fetchMore());\n\n return {\n ...response,\n error: response.error as NovuError | undefined,\n data: response.data\n ? {\n messages: [...response.data.messages],\n hasMore: response.data.hasMore,\n }\n : undefined,\n };\n }, [callRuntime]);\n\n const paginationWithFetch = useMemo(\n () => ({\n status: snapshot.pagination.status,\n hasMore: snapshot.pagination.hasMore,\n fetchMore,\n }),\n [snapshot.pagination.status, snapshot.pagination.hasMore, fetchMore]\n );\n\n const sendMessage = useCallback(\n (input: SendMessageInput) => callRuntime((target) => target.sendMessage(input)),\n [callRuntime]\n );\n const respondToAction = useCallback(\n (args: { actionId: string; decision: AgentToolApprovalDecision }) =>\n callRuntime((target) => target.respondToAction(args)),\n [callRuntime]\n );\n const sendAction = useCallback(\n (args: { actionId: string; sourceMessageId: string; value?: string }) =>\n callRuntime((target) => target.sendAction(args)),\n [callRuntime]\n );\n const retryMessage = useCallback(\n (messageId: string) => callRuntime((target) => target.retryMessage(messageId)),\n [callRuntime]\n );\n\n return {\n messages: [...snapshot.messages],\n pendingActions: [...snapshot.pendingActions],\n conversationId: snapshot.conversationId,\n error: webChatLoadError ?? (snapshot.error as UseWebChatResult['error']),\n isLoading: !webChatLoadError && (isWebChatLoading || snapshot.status === 'loading'),\n isRunning: snapshot.run.isRunning,\n typing: snapshot.run.typing,\n conversationStatus: snapshot.conversationStatus,\n run: snapshot.run,\n pagination: paginationWithFetch,\n isRecovering: snapshot.isRecovering,\n catchUpError: snapshot.catchUpError,\n refetch,\n sendMessage,\n respondToAction,\n sendAction,\n retryMessage,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBA,gBAA0B;AAC1B,mBAA+G;AAC/G,wBAA2B;AAC3B,0BAAwB;AAsGxB,IAAM,wBAAwB;AAAA,EAC5B,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,KAAK,EAAE,WAAW,MAAM;AAAA,EACxB,oBAAoB;AAAA,EACpB,YAAY,EAAE,SAAS,OAAO,QAAQ,OAAO;AAAA,EAC7C,UAAU,CAAC;AAAA,EACX,gBAAgB,CAAC;AAAA,EACjB,cAAc;AAChB;AAOA,SAAS,2BAA2B,MAQ3B;AApJT;AAqJE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAK,6BAAM,oBAAiB,kCAAM,WAAN,mBAAc,UAAS,cAAc,CAAC,gBAAgB,WAAW,oBAAoB;AAC/G,QAAI,SAAS,gBAAgB;AAC3B,sBAAgB,UAAU;AAC1B,2BAAS,SAAQ,cAAjB,4BAA6B;AAAA,QAC3B,gBAAgB,SAAS;AAAA,QACzB,UAAU,CAAC,GAAG,SAAS,QAAQ;AAAA,QAC/B,SAAS,SAAS,WAAW;AAAA,MAC/B;AAAA,IACF;AAAA,EACF;AAEA,MAAI,SAAS,gBAAgB,SAAS,iBAAiB,wBAAwB,SAAS;AACtF,4BAAwB,UAAU,SAAS;AAC3C,yBAAS,SAAQ,YAAjB,4BAA2B,SAAS;AAAA,EACtC,WAAW,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,CAAC,WAAW,OAAO,gBAAgB,IAAI,CAAC;AAAA,IACtD,CAAC,WAAW;AAAA,EACd;AACA,QAAM,iBAAa;AAAA,IACjB,CAAC,SACC,YAAY,CAAC,WAAW,OAAO,WAAW,IAAI,CAAC;AAAA,IACjD,CAAC,WAAW;AAAA,EACd;AACA,QAAM,mBAAe;AAAA,IACnB,CAAC,cAAsB,YAAY,CAAC,WAAW,OAAO,aAAa,SAAS,CAAC;AAAA,IAC7E,CAAC,WAAW;AAAA,EACd;AAEA,SAAO;AAAA,IACL,UAAU,CAAC,GAAG,SAAS,QAAQ;AAAA,IAC/B,gBAAgB,CAAC,GAAG,SAAS,cAAc;AAAA,IAC3C,gBAAgB,SAAS;AAAA,IACzB,OAAO,oBAAqB,SAAS;AAAA,IACrC,WAAW,CAAC,qBAAqB,oBAAoB,SAAS,WAAW;AAAA,IACzE,WAAW,SAAS,IAAI;AAAA,IACxB,QAAQ,SAAS,IAAI;AAAA,IACrB,oBAAoB,SAAS;AAAA,IAC7B,KAAK,SAAS;AAAA,IACd,YAAY;AAAA,IACZ,cAAc,SAAS;AAAA,IACvB,cAAc,SAAS;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["_a","snapshot"]}
1
+ {"version":3,"sources":["../../../src/hooks/useWebChat.ts"],"sourcesContent":["import type {\n AgentConversationPublicationMeta,\n AgentConversationRunSnapshot,\n AgentConversationRuntime,\n AgentConversationSnapshot,\n AgentConversationStatus,\n AgentEventEnvelope,\n AgentHashFields,\n AgentMessage,\n AgentPendingAction,\n AgentToolApprovalDecision,\n LoadConversationResult,\n RespondToActionResult,\n SendActionResult,\n SendMessageInput,\n SendMessageResult,\n WebChatPagination,\n WebChatPlanLimitError,\n} from '@novu/js';\nimport { NovuError } from '@novu/js';\nimport { type MutableRefObject, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport { useDataRef } from './internal/useDataRef';\nimport { useNovu } from './NovuProvider';\n\ntype UseWebChatCallbacks = {\n onSuccess?: (data: LoadConversationResult) => void;\n onError?: (error: NovuError | WebChatPlanLimitError) => void;\n /**\n * Fires once when a message id first appears. History pages do not fire.\n * The first event of a turn can create an empty assistant message before text arrives.\n * A send that never reaches the server does not fire. The message status becomes `failed` instead.\n */\n onMessage?: (message: AgentMessage) => void;\n /**\n * Fires once per pending action, including actions still pending on mount.\n * Paging backwards does not fire.\n */\n onActionRequested?: (action: AgentPendingAction) => void;\n /**\n * Live event envelopes for this conversation.\n * Duplicates that the client drops do not fire.\n * Envelopes that arrive before the conversation id exists do not fire.\n * The message list in this render does not include this envelope yet.\n */\n onEvent?: (envelope: AgentEventEnvelope) => void;\n};\n\n/** Arguments for {@link useWebChat}. Pass `agentId`, or pass `conversation`. Do not mix the two. */\nexport type UseWebChatProps = UseWebChatCallbacks &\n AgentHashFields &\n (\n | {\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 */\n conversationId?: string;\n conversation?: never;\n }\n | {\n /** Share an existing conversation runtime across multiple hook instances. */\n conversation: AgentConversationRuntime;\n agentId?: never;\n conversationId?: never;\n agentHash?: never;\n }\n );\n\n/**\n * State and actions returned by {@link useWebChat}.\n * `sendMessage`, `respondToAction`, `sendAction`, and `retryMessage` resolve `{ data, error }` and never reject.\n * Inspect `error` on the result, or show hook `error`.\n */\nexport type UseWebChatResult = {\n /** Conversation timeline. */\n messages: AgentMessage[];\n /** Tool approvals and MCP connect items that are still pending. */\n pendingActions: AgentPendingAction[];\n /** Server conversation id after create or resume. */\n conversationId?: string;\n /** Last error from load, send, retry, or action. Mutations also return `{ error }` for that call. */\n error?: NovuError | WebChatPlanLimitError;\n /** True while Web Chat loads and, for an existing conversation, until the first history fetch completes. */\n isLoading: boolean;\n /** True while the agent turn is in progress. Same as `run.isRunning`. */\n isRunning: boolean;\n /** Typing indicator. Same as `run.typing`. Absent when the agent is not typing. */\n typing?: AgentConversationRunSnapshot['typing'];\n /** `'active'` or `'resolved'`. The agent sets `resolved` with `ctx.resolve()`. Not a loading flag. */\n conversationStatus: AgentConversationStatus;\n /** Current agent-run snapshot. */\n run: AgentConversationRunSnapshot;\n /** Older-history control. Not a top-level `hasMore` or `fetchMore`. */\n pagination: WebChatPagination & {\n fetchMore: () => Promise<{\n data?: { messages: AgentMessage[]; hasMore: boolean };\n error?: NovuError;\n }>;\n };\n /** True while reconnect recovery is in progress. */\n isRecovering: boolean;\n /** Set when reconnect recovery fails. Separate from send and fetch `error`. */\n catchUpError?: NovuError;\n /** Reload the newest history page. No-op when there is no conversation id. */\n refetch: () => Promise<void>;\n /**\n * Send a user message. `input` is a string, or `{ text, metadata }`. Creates a conversation when `conversationId` is omitted.\n * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.\n */\n sendMessage: (input: SendMessageInput) => Promise<{\n data?: SendMessageResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /**\n * Resolve a pending `approval`. Pass `approvalId` from `pendingActions` or message parts.\n * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.\n */\n respondToAction: (args: { approvalId: string; decision: AgentToolApprovalDecision }) => Promise<{\n data?: RespondToActionResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /**\n * Click a Card button. Do not use this for tool approval.\n * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.\n */\n sendAction: (args: { actionId: string; sourceMessageId: string; value?: string }) => Promise<{\n data?: SendActionResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /**\n * Resend a message whose `status` is `failed`. Reuses the original idempotency key.\n * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.\n */\n retryMessage: (messageId: string) => Promise<{\n data?: SendMessageResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /**\n * Start a new empty chat for the current `agentId`. The next `sendMessage` creates the server conversation.\n * No-op when `conversationId` or `conversation` is provided.\n */\n startNewConversation: () => void;\n};\n\nconst EMPTY_SERVER_SNAPSHOT = {\n key: 'ssr',\n status: 'loading',\n run: { isRunning: false },\n conversationStatus: 'active',\n pagination: { hasMore: false, status: 'idle' },\n messages: [],\n pendingActions: [],\n isRecovering: false,\n} as AgentConversationSnapshot;\n\ntype RuntimeActionResult<T> = {\n data?: T;\n error?: NovuError | WebChatPlanLimitError;\n};\n\nfunction handlePublicationCallbacks(args: {\n snapshot: AgentConversationSnapshot;\n meta: AgentConversationPublicationMeta | undefined;\n conversationIdProp: string | undefined;\n propsRef: ReturnType<typeof useDataRef<UseWebChatProps>>;\n loadNotifiedRef: MutableRefObject<boolean>;\n notifiedCatchUpErrorRef: MutableRefObject<NovuError | undefined>;\n lastReportedErrorKeyRef: MutableRefObject<string | undefined>;\n}): void {\n const {\n snapshot,\n meta,\n conversationIdProp,\n propsRef,\n loadNotifiedRef,\n notifiedCatchUpErrorRef,\n lastReportedErrorKeyRef,\n } = args;\n\n if ((meta?.historyLoaded || meta?.change?.kind === 'history') && !loadNotifiedRef.current && conversationIdProp) {\n if (snapshot.conversationId) {\n loadNotifiedRef.current = true;\n propsRef.current.onSuccess?.({\n conversationId: snapshot.conversationId,\n messages: [...snapshot.messages],\n hasMore: snapshot.pagination.hasMore,\n });\n }\n }\n\n if (snapshot.catchUpError && snapshot.catchUpError !== notifiedCatchUpErrorRef.current) {\n notifiedCatchUpErrorRef.current = snapshot.catchUpError;\n propsRef.current.onError?.(snapshot.catchUpError);\n } else if (!snapshot.catchUpError) {\n notifiedCatchUpErrorRef.current = undefined;\n }\n\n if (snapshot.error) {\n const originalMessage = 'originalError' in snapshot.error ? (snapshot.error.originalError?.message ?? '') : '';\n const errorKey = `${snapshot.error.message}:${originalMessage}`;\n if (lastReportedErrorKeyRef.current !== errorKey) {\n lastReportedErrorKeyRef.current = errorKey;\n propsRef.current.onError?.(snapshot.error as NovuError | WebChatPlanLimitError);\n }\n } else {\n lastReportedErrorKeyRef.current = undefined;\n }\n\n const change = meta?.change;\n if (change?.kind === 'live') {\n propsRef.current.onEvent?.(change.envelope);\n }\n\n if (change && change.kind !== 'history') {\n for (const message of change.addedMessages) {\n propsRef.current.onMessage?.(message);\n }\n }\n\n if (change) {\n for (const action of change.newActions) {\n propsRef.current.onActionRequested?.(action);\n }\n }\n}\n\ntype OwnedRuntimeEntry = {\n key: string;\n novu: ReturnType<typeof useNovu>;\n runtime: AgentConversationRuntime;\n};\n\nfunction getCreateFlowKey(agentId: string, agentHash?: string): string {\n return `${agentId}\\0${agentHash ?? ''}`;\n}\n\nfunction getManagedRuntimeKey(\n agentId: string,\n agentHash: string | undefined,\n conversationIdProp: string | undefined,\n createEpoch: number\n): string {\n if (conversationIdProp) {\n return `resume:${agentId}\\0${agentHash ?? ''}\\0${conversationIdProp}`;\n }\n\n return `${getCreateFlowKey(agentId, agentHash)}\\0${createEpoch}`;\n}\n\ntype ManagedRuntimeEntry = {\n key: string;\n runtime: AgentConversationRuntime;\n};\n\ntype WebChatLoadState =\n | { novu: ReturnType<typeof useNovu>; status: 'loading' }\n | { novu: ReturnType<typeof useNovu>; status: 'ready' }\n | { novu: ReturnType<typeof useNovu>; status: 'error'; error: NovuError };\n\nfunction toNovuError(error: unknown): NovuError {\n if (error instanceof NovuError) {\n return error;\n }\n\n if (error instanceof Error) {\n return new NovuError('Failed to load Web Chat', error);\n }\n\n return new NovuError('Failed to load Web Chat', new Error(String(error)));\n}\n\n/**\n * Headless Web Chat client. Use it inside `NovuProvider`.\n *\n * @example\n * ```tsx\n * const { messages, sendMessage, isRunning, isLoading, error } = useWebChat({\n * agentId: 'YOUR_AGENT_IDENTIFIER',\n * });\n * ```\n */\nexport const useWebChat = (props: UseWebChatProps): UseWebChatResult => {\n const novu = useNovu();\n const propsRef = useDataRef(props);\n const [loadState, setLoadState] = useState<WebChatLoadState>(() => ({\n novu,\n status: 'loading',\n }));\n\n useEffect(() => {\n let cancelled = false;\n\n if (!novu.isWebChatLoaded) {\n setLoadState({ novu, status: 'loading' });\n }\n\n void novu\n .loadWebChat()\n .then(() => {\n if (!cancelled) {\n setLoadState({ novu, status: 'ready' });\n }\n })\n .catch((error: unknown) => {\n if (cancelled) {\n return;\n }\n\n const novuError = toNovuError(error);\n propsRef.current.onError?.(novuError);\n setLoadState({ novu, status: 'error', error: novuError });\n });\n\n return () => {\n cancelled = true;\n };\n }, [novu, propsRef]);\n\n const webChatReady = loadState.novu === novu && loadState.status === 'ready';\n const webChatLoadError = loadState.novu === novu && loadState.status === 'error' ? loadState.error : undefined;\n const isWebChatLoading = loadState.novu !== novu || loadState.status === 'loading';\n\n const sharedRuntime = 'conversation' in props ? props.conversation : undefined;\n const agentId = sharedRuntime?.agentId ?? props.agentId!;\n const conversationIdProp = sharedRuntime ? undefined : props.conversationId;\n const agentHash = sharedRuntime ? undefined : props.agentHash;\n\n const ownedRuntimeRef = useRef<OwnedRuntimeEntry | null>(null);\n const [managedRuntime, setManagedRuntime] = useState<ManagedRuntimeEntry | null>(null);\n const [createEpoch, setCreateEpoch] = useState(0);\n const managedRuntimeKey = sharedRuntime\n ? null\n : getManagedRuntimeKey(agentId, agentHash, conversationIdProp, createEpoch);\n\n useEffect(() => {\n if (sharedRuntime) {\n ownedRuntimeRef.current?.runtime.dispose();\n ownedRuntimeRef.current = null;\n setManagedRuntime(null);\n\n return;\n }\n\n if (!webChatReady || !managedRuntimeKey) {\n setManagedRuntime(null);\n\n return;\n }\n\n const key = managedRuntimeKey;\n const current = ownedRuntimeRef.current;\n\n let runtime: AgentConversationRuntime;\n if (current?.novu === novu && current.key === key) {\n runtime = current.runtime;\n } else {\n current?.runtime.dispose();\n runtime = conversationIdProp\n ? novu.webChat.conversation({ agentId, conversationId: conversationIdProp, agentHash })\n : novu.webChat.conversation({ agentId, agentHash });\n ownedRuntimeRef.current = { key, novu, runtime };\n }\n\n setManagedRuntime({ key, runtime });\n\n return () => {\n ownedRuntimeRef.current?.runtime.dispose();\n ownedRuntimeRef.current = null;\n setManagedRuntime(null);\n };\n }, [webChatReady, sharedRuntime, novu, agentId, conversationIdProp, agentHash, createEpoch, managedRuntimeKey]);\n\n const runtime =\n sharedRuntime ?? (managedRuntime?.key === managedRuntimeKey ? managedRuntime.runtime : null);\n\n const loadNotifiedRef = useRef(false);\n const replayedActionsRef = useRef(false);\n const notifiedCatchUpErrorRef = useRef<NovuError | undefined>();\n const lastReportedErrorKeyRef = useRef<string>();\n\n useEffect(() => {\n loadNotifiedRef.current = false;\n replayedActionsRef.current = false;\n notifiedCatchUpErrorRef.current = undefined;\n lastReportedErrorKeyRef.current = undefined;\n }, [runtime]);\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n if (!runtime) {\n return () => {};\n }\n\n if (!replayedActionsRef.current) {\n replayedActionsRef.current = true;\n for (const action of runtime.getSnapshot().pendingActions) {\n propsRef.current.onActionRequested?.(action);\n }\n }\n\n return runtime.subscribe((snapshot, meta) => {\n onStoreChange();\n handlePublicationCallbacks({\n snapshot,\n meta,\n conversationIdProp,\n propsRef,\n loadNotifiedRef,\n notifiedCatchUpErrorRef,\n lastReportedErrorKeyRef,\n });\n });\n },\n [runtime, conversationIdProp, propsRef]\n );\n\n const getSnapshot = useCallback(() => {\n return runtime?.getSnapshot() ?? EMPTY_SERVER_SNAPSHOT;\n }, [runtime]);\n\n const getServerSnapshot = useCallback(() => {\n return runtime?.getServerSnapshot() ?? EMPTY_SERVER_SNAPSHOT;\n }, [runtime]);\n\n const snapshot = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n\n const callRuntime = useCallback(\n async <T>(action: (target: AgentConversationRuntime) => Promise<RuntimeActionResult<T>>) => {\n if (!runtime) {\n const error =\n webChatLoadError ??\n new NovuError(\n isWebChatLoading ? 'Web Chat is still loading' : 'Web Chat runtime is unavailable',\n new Error('Web Chat runtime is not ready')\n );\n propsRef.current.onError?.(error);\n\n return { error };\n }\n\n const response = await action(runtime);\n if (response.error) {\n propsRef.current.onError?.(response.error);\n }\n\n return response;\n },\n [runtime, webChatLoadError, isWebChatLoading, propsRef]\n );\n\n const refetch = useCallback(async () => {\n if (!runtime) {\n return;\n }\n\n const response = await runtime.load();\n if (response.data) {\n propsRef.current.onSuccess?.({\n conversationId: response.data.conversationId,\n messages: [...response.data.messages],\n hasMore: response.data.hasMore,\n });\n }\n }, [runtime, propsRef]);\n\n const fetchMore = useCallback(async () => {\n const response = await callRuntime((target) => target.fetchMore());\n\n return {\n ...response,\n error: response.error as NovuError | undefined,\n data: response.data\n ? {\n messages: [...response.data.messages],\n hasMore: response.data.hasMore,\n }\n : undefined,\n };\n }, [callRuntime]);\n\n const paginationWithFetch = useMemo(\n () => ({\n status: snapshot.pagination.status,\n hasMore: snapshot.pagination.hasMore,\n fetchMore,\n }),\n [snapshot.pagination.status, snapshot.pagination.hasMore, fetchMore]\n );\n\n const sendMessage = useCallback(\n (input: SendMessageInput) => callRuntime((target) => target.sendMessage(input)),\n [callRuntime]\n );\n const respondToAction = useCallback(\n (args: { approvalId: string; decision: AgentToolApprovalDecision }) =>\n callRuntime((target) => target.respondToAction(args)),\n [callRuntime]\n );\n const sendAction = useCallback(\n (args: { actionId: string; sourceMessageId: string; value?: string }) =>\n callRuntime((target) => target.sendAction(args)),\n [callRuntime]\n );\n const retryMessage = useCallback(\n (messageId: string) => callRuntime((target) => target.retryMessage(messageId)),\n [callRuntime]\n );\n const startNewConversation = useCallback(() => {\n if (sharedRuntime || conversationIdProp) {\n return;\n }\n\n setCreateEpoch((epoch) => epoch + 1);\n }, [sharedRuntime, conversationIdProp]);\n\n return {\n messages: [...snapshot.messages],\n pendingActions: [...snapshot.pendingActions],\n conversationId: snapshot.conversationId,\n error: webChatLoadError ?? (snapshot.error as UseWebChatResult['error']),\n isLoading: !webChatLoadError && (isWebChatLoading || snapshot.status === 'loading'),\n isRunning: snapshot.run.isRunning,\n typing: snapshot.run.typing,\n conversationStatus: snapshot.conversationStatus,\n run: snapshot.run,\n pagination: paginationWithFetch,\n isRecovering: snapshot.isRecovering,\n catchUpError: snapshot.catchUpError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,iBAAiB,oBAAoB;AACvC;AAAA,IACF;AAEA,mBAAe,CAAC,UAAU,QAAQ,CAAC;AAAA,EACrC,GAAG,CAAC,eAAe,kBAAkB,CAAC;AAEtC,SAAO;AAAA,IACL,UAAU,CAAC,GAAG,SAAS,QAAQ;AAAA,IAC/B,gBAAgB,CAAC,GAAG,SAAS,cAAc;AAAA,IAC3C,gBAAgB,SAAS;AAAA,IACzB,OAAO,oBAAqB,SAAS;AAAA,IACrC,WAAW,CAAC,qBAAqB,oBAAoB,SAAS,WAAW;AAAA,IACzE,WAAW,SAAS,IAAI;AAAA,IACxB,QAAQ,SAAS,IAAI;AAAA,IACrB,oBAAoB,SAAS;AAAA,IAC7B,KAAK,SAAS;AAAA,IACd,YAAY;AAAA,IACZ,cAAc,SAAS;AAAA,IACvB,cAAc,SAAS;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["runtime","_a","snapshot"]}
@@ -38,7 +38,11 @@ type UseWebChatProps = UseWebChatCallbacks & AgentHashFields & ({
38
38
  conversationId?: never;
39
39
  agentHash?: never;
40
40
  });
41
- /** State and actions returned by {@link useWebChat}. */
41
+ /**
42
+ * State and actions returned by {@link useWebChat}.
43
+ * `sendMessage`, `respondToAction`, `sendAction`, and `retryMessage` resolve `{ data, error }` and never reject.
44
+ * Inspect `error` on the result, or show hook `error`.
45
+ */
42
46
  type UseWebChatResult = {
43
47
  /** Conversation timeline. */
44
48
  messages: AgentMessage[];
@@ -46,7 +50,7 @@ type UseWebChatResult = {
46
50
  pendingActions: AgentPendingAction[];
47
51
  /** Server conversation id after create or resume. */
48
52
  conversationId?: string;
49
- /** Last error from load, send, retry, or action. */
53
+ /** Last error from load, send, retry, or action. Mutations also return `{ error }` for that call. */
50
54
  error?: NovuError | WebChatPlanLimitError;
51
55
  /** True while Web Chat loads and, for an existing conversation, until the first history fetch completes. */
52
56
  isLoading: boolean;
@@ -74,20 +78,29 @@ type UseWebChatResult = {
74
78
  catchUpError?: NovuError;
75
79
  /** Reload the newest history page. No-op when there is no conversation id. */
76
80
  refetch: () => Promise<void>;
77
- /** Send a user message. `input` is a string, or `{ text, metadata }`. Creates a conversation when `conversationId` is omitted. */
81
+ /**
82
+ * Send a user message. `input` is a string, or `{ text, metadata }`. Creates a conversation when `conversationId` is omitted.
83
+ * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.
84
+ */
78
85
  sendMessage: (input: SendMessageInput) => Promise<{
79
86
  data?: SendMessageResult;
80
87
  error?: NovuError | WebChatPlanLimitError;
81
88
  }>;
82
- /** Resolve a pending `tool-approval`. Pass `action.id` from `pendingActions`. */
89
+ /**
90
+ * Resolve a pending `approval`. Pass `approvalId` from `pendingActions` or message parts.
91
+ * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.
92
+ */
83
93
  respondToAction: (args: {
84
- actionId: string;
94
+ approvalId: string;
85
95
  decision: AgentToolApprovalDecision;
86
96
  }) => Promise<{
87
97
  data?: RespondToActionResult;
88
98
  error?: NovuError | WebChatPlanLimitError;
89
99
  }>;
90
- /** Click a Card button. Do not use this for tool approval. */
100
+ /**
101
+ * Click a Card button. Do not use this for tool approval.
102
+ * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.
103
+ */
91
104
  sendAction: (args: {
92
105
  actionId: string;
93
106
  sourceMessageId: string;
@@ -96,11 +109,19 @@ type UseWebChatResult = {
96
109
  data?: SendActionResult;
97
110
  error?: NovuError | WebChatPlanLimitError;
98
111
  }>;
99
- /** Resend a message whose `status` is `failed`. Reuses the original idempotency key. */
112
+ /**
113
+ * Resend a message whose `status` is `failed`. Reuses the original idempotency key.
114
+ * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.
115
+ */
100
116
  retryMessage: (messageId: string) => Promise<{
101
117
  data?: SendMessageResult;
102
118
  error?: NovuError | WebChatPlanLimitError;
103
119
  }>;
120
+ /**
121
+ * Start a new empty chat for the current `agentId`. The next `sendMessage` creates the server conversation.
122
+ * No-op when `conversationId` or `conversation` is provided.
123
+ */
124
+ startNewConversation: () => void;
104
125
  };
105
126
  /**
106
127
  * Headless Web Chat client. Use it inside `NovuProvider`.
@@ -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
+ pendingActionKey: () => import_js.pendingActionKey,
40
41
  useChannelConnection: () => import_hooks.useChannelConnection,
41
42
  useChannelConnections: () => import_hooks.useChannelConnections,
42
43
  useChannelEndpoint: () => import_hooks.useChannelEndpoint,
@@ -78,6 +79,7 @@ var import_hooks = require("./hooks/index.cjs");
78
79
  SubscriptionPreferences,
79
80
  TelegramConnectButton,
80
81
  WorkflowCriticalityEnum,
82
+ pendingActionKey,
81
83
  useChannelConnection,
82
84
  useChannelConnections,
83
85
  useChannelEndpoint,
@@ -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 UseWebChatProps,\n UseWebChatResult,\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 useWebChat,\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":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type * from '@novu/js';\nexport { pendingActionKey, 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 UseWebChatProps,\n UseWebChatResult,\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 useWebChat,\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;AAAA;AACA,gBAA8F;AAiD9F,wBAeO;AAuBP,mBAkBO;","names":[]}
@@ -1,5 +1,5 @@
1
1
  export * from '@novu/js';
2
- export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';
2
+ export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum, pendingActionKey } from '@novu/js';
3
3
  export { AllLocalization, AllLocalizationKey, ChannelConnectButtonIconKey, ElementStyles, InboxAppearance, InboxAppearanceCallback, InboxAppearanceCallbackFunction, InboxAppearanceCallbackKeys, InboxAppearanceKey, InboxElements, InboxLocalization, InboxLocalizationKey, InboxTheme, NotificationActionClickHandler, NotificationClickHandler, NotificationRenderer, PreferenceGroups, PreferencesFilter, RouterPush, SubscriptionAppearance, SubscriptionAppearanceCallback, SubscriptionAppearanceCallbackFunction, SubscriptionAppearanceCallbackKeys, SubscriptionAppearanceKey, SubscriptionElements, SubscriptionLocalization, SubscriptionLocalizationKey, SubscriptionTheme, Tab, Variables } from '@novu/js/ui';
4
4
  export { NovuProvider, NovuProviderProps, useNovu } from './hooks/NovuProvider.cjs';
5
5
  export { Bell, BellProps } from './components/Bell.cjs';
@@ -37,6 +37,7 @@ __export(server_exports, {
37
37
  SubscriptionPreferences: () => SubscriptionPreferences,
38
38
  TelegramConnectButton: () => TelegramConnectButton,
39
39
  WorkflowCriticalityEnum: () => import_js.WorkflowCriticalityEnum,
40
+ pendingActionKey: () => import_js.pendingActionKey,
40
41
  useCounts: () => useCounts,
41
42
  useCreateSubscription: () => useCreateSubscription,
42
43
  useNotifications: () => useNotifications,
@@ -112,7 +113,9 @@ function useWebChat(_) {
112
113
  sendMessage: () => Promise.resolve({ data: void 0, error: void 0 }),
113
114
  respondToAction: () => Promise.resolve({ data: void 0, error: void 0 }),
114
115
  sendAction: () => Promise.resolve({ data: void 0, error: void 0 }),
115
- retryMessage: () => Promise.resolve({ data: void 0, error: void 0 })
116
+ retryMessage: () => Promise.resolve({ data: void 0, error: void 0 }),
117
+ startNewConversation: () => {
118
+ }
116
119
  };
117
120
  }
118
121
  function useCounts(_) {
@@ -203,6 +206,7 @@ function useSubscriptions(_) {
203
206
  SubscriptionPreferences,
204
207
  TelegramConnectButton,
205
208
  WorkflowCriticalityEnum,
209
+ pendingActionKey,
206
210
  useCounts,
207
211
  useCreateSubscription,
208
212
  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 UseWebChatProps,\n UseWebChatResult,\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 useWebChat(_: UseWebChatProps): UseWebChatResult {\n return {\n messages: [],\n pendingActions: [],\n isLoading: true,\n isRunning: false,\n typing: undefined,\n conversationStatus: 'active',\n run: { isRunning: false },\n pagination: {\n status: 'idle',\n hasMore: false,\n fetchMore: () => Promise.resolve({ data: undefined, error: undefined }),\n },\n isRecovering: false,\n catchUpError: undefined,\n refetch: () => Promise.resolve(),\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 retryMessage: () => 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 UseWebChatProps,\n UseWebChatResult,\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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ACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;AAEO,SAAS,gBAAgB,GAAgD;AAC9E,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/server/index.tsx"],"sourcesContent":["import type { InboxProps } from '../components/Inbox';\nimport { ShadowRootDetector } from '../components/ShadowRootDetector';\nimport type {\n UseWebChatProps,\n UseWebChatResult,\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 useWebChat(_: UseWebChatProps): UseWebChatResult {\n return {\n messages: [],\n pendingActions: [],\n isLoading: true,\n isRunning: false,\n typing: undefined,\n conversationStatus: 'active',\n run: { isRunning: false },\n pagination: {\n status: 'idle',\n hasMore: false,\n fetchMore: () => Promise.resolve({ data: undefined, error: undefined }),\n },\n isRecovering: false,\n catchUpError: undefined,\n refetch: () => Promise.resolve(),\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 retryMessage: () => Promise.resolve({ data: undefined, error: undefined }),\n startNewConversation: () => {},\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 { pendingActionKey, 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 UseWebChatProps,\n UseWebChatResult,\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;AAAA;AACA,gCAAmC;AAsLnC,gBAA8F;AAvJrF;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,SAAS,aAAa,OAA0B;AACrD,SAAO,2EAAG,gB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OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { InboxProps } from '../components/Inbox.cjs';
3
3
  export * from '@novu/js';
4
- export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';
4
+ export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum, pendingActionKey } from '@novu/js';
5
5
  import { NovuProviderProps } from '../hooks/NovuProvider.cjs';
6
6
  import { UseWebChatProps, UseWebChatResult } from '../hooks/useWebChat.cjs';
7
7
  import { UseCountsProps, UseCountsResult } from '../hooks/useCounts.cjs';
@@ -1,5 +1,5 @@
1
1
  export * from '@novu/js';
2
- export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';
2
+ export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum, pendingActionKey } from '@novu/js';
3
3
  export { NovuProvider, useNovu } from './NovuProvider.js';
4
4
  export { UseWebChatProps, UseWebChatResult, useWebChat } from './useWebChat.js';
5
5
  export { UseChannelConnectionProps, UseChannelConnectionResult, useChannelConnection } from './useChannelConnection.js';
@@ -1,5 +1,5 @@
1
1
  // src/hooks/index.ts
2
- import { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from "@novu/js";
2
+ import { pendingActionKey, PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from "@novu/js";
3
3
  import { NovuProvider, useNovu } from "./NovuProvider.js";
4
4
  export * from "./useWebChat.js";
5
5
  export * from "./useChannelConnection.js";
@@ -24,6 +24,7 @@ export {
24
24
  PreferenceLevel,
25
25
  SeverityLevelEnum,
26
26
  WorkflowCriticalityEnum,
27
+ pendingActionKey,
27
28
  useNovu
28
29
  };
29
30
  //# sourceMappingURL=index.js.map
@@ -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 './useWebChat';\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":";AACA,SAAS,iBAAiB,mBAAmB,+BAA+B;AAC5E,SAAS,cAAc,eAAe;AACtC,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export type * from '@novu/js';\nexport { pendingActionKey, PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';\nexport { NovuProvider, useNovu } from './NovuProvider';\nexport * from './useWebChat';\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":";AACA,SAAS,kBAAkB,iBAAiB,mBAAmB,+BAA+B;AAC9F,SAAS,cAAc,eAAe;AACtC,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -38,7 +38,11 @@ type UseWebChatProps = UseWebChatCallbacks & AgentHashFields & ({
38
38
  conversationId?: never;
39
39
  agentHash?: never;
40
40
  });
41
- /** State and actions returned by {@link useWebChat}. */
41
+ /**
42
+ * State and actions returned by {@link useWebChat}.
43
+ * `sendMessage`, `respondToAction`, `sendAction`, and `retryMessage` resolve `{ data, error }` and never reject.
44
+ * Inspect `error` on the result, or show hook `error`.
45
+ */
42
46
  type UseWebChatResult = {
43
47
  /** Conversation timeline. */
44
48
  messages: AgentMessage[];
@@ -46,7 +50,7 @@ type UseWebChatResult = {
46
50
  pendingActions: AgentPendingAction[];
47
51
  /** Server conversation id after create or resume. */
48
52
  conversationId?: string;
49
- /** Last error from load, send, retry, or action. */
53
+ /** Last error from load, send, retry, or action. Mutations also return `{ error }` for that call. */
50
54
  error?: NovuError | WebChatPlanLimitError;
51
55
  /** True while Web Chat loads and, for an existing conversation, until the first history fetch completes. */
52
56
  isLoading: boolean;
@@ -74,20 +78,29 @@ type UseWebChatResult = {
74
78
  catchUpError?: NovuError;
75
79
  /** Reload the newest history page. No-op when there is no conversation id. */
76
80
  refetch: () => Promise<void>;
77
- /** Send a user message. `input` is a string, or `{ text, metadata }`. Creates a conversation when `conversationId` is omitted. */
81
+ /**
82
+ * Send a user message. `input` is a string, or `{ text, metadata }`. Creates a conversation when `conversationId` is omitted.
83
+ * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.
84
+ */
78
85
  sendMessage: (input: SendMessageInput) => Promise<{
79
86
  data?: SendMessageResult;
80
87
  error?: NovuError | WebChatPlanLimitError;
81
88
  }>;
82
- /** Resolve a pending `tool-approval`. Pass `action.id` from `pendingActions`. */
89
+ /**
90
+ * Resolve a pending `approval`. Pass `approvalId` from `pendingActions` or message parts.
91
+ * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.
92
+ */
83
93
  respondToAction: (args: {
84
- actionId: string;
94
+ approvalId: string;
85
95
  decision: AgentToolApprovalDecision;
86
96
  }) => Promise<{
87
97
  data?: RespondToActionResult;
88
98
  error?: NovuError | WebChatPlanLimitError;
89
99
  }>;
90
- /** Click a Card button. Do not use this for tool approval. */
100
+ /**
101
+ * Click a Card button. Do not use this for tool approval.
102
+ * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.
103
+ */
91
104
  sendAction: (args: {
92
105
  actionId: string;
93
106
  sourceMessageId: string;
@@ -96,11 +109,19 @@ type UseWebChatResult = {
96
109
  data?: SendActionResult;
97
110
  error?: NovuError | WebChatPlanLimitError;
98
111
  }>;
99
- /** Resend a message whose `status` is `failed`. Reuses the original idempotency key. */
112
+ /**
113
+ * Resend a message whose `status` is `failed`. Reuses the original idempotency key.
114
+ * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.
115
+ */
100
116
  retryMessage: (messageId: string) => Promise<{
101
117
  data?: SendMessageResult;
102
118
  error?: NovuError | WebChatPlanLimitError;
103
119
  }>;
120
+ /**
121
+ * Start a new empty chat for the current `agentId`. The next `sendMessage` creates the server conversation.
122
+ * No-op when `conversationId` or `conversation` is provided.
123
+ */
124
+ startNewConversation: () => void;
104
125
  };
105
126
  /**
106
127
  * Headless Web Chat client. Use it inside `NovuProvider`.
@@ -67,16 +67,11 @@ function handlePublicationCallbacks(args) {
67
67
  function getCreateFlowKey(agentId, agentHash) {
68
68
  return `${agentId}\0${agentHash ?? ""}`;
69
69
  }
70
- function resolveOwnedRuntime(args) {
71
- const key = getCreateFlowKey(args.agentId, args.agentHash);
72
- const current = args.ownedRuntimeRef.current;
73
- if (current?.novu === args.novu && current.key === key) {
74
- return current.runtime;
70
+ function getManagedRuntimeKey(agentId, agentHash, conversationIdProp, createEpoch) {
71
+ if (conversationIdProp) {
72
+ return `resume:${agentId}\0${agentHash ?? ""}\0${conversationIdProp}`;
75
73
  }
76
- current?.runtime.dispose();
77
- const runtime = args.novu.webChat.conversation({ agentId: args.agentId, agentHash: args.agentHash });
78
- args.ownedRuntimeRef.current = { key, novu: args.novu, runtime };
79
- return runtime;
74
+ return `${getCreateFlowKey(agentId, agentHash)}\0${createEpoch}`;
80
75
  }
81
76
  function toNovuError(error) {
82
77
  if (error instanceof NovuError) {
@@ -123,41 +118,38 @@ var useWebChat = (props) => {
123
118
  const conversationIdProp = sharedRuntime ? void 0 : props.conversationId;
124
119
  const agentHash = sharedRuntime ? void 0 : props.agentHash;
125
120
  const ownedRuntimeRef = useRef(null);
121
+ const [managedRuntime, setManagedRuntime] = useState(null);
122
+ const [createEpoch, setCreateEpoch] = useState(0);
123
+ const managedRuntimeKey = sharedRuntime ? null : getManagedRuntimeKey(agentId, agentHash, conversationIdProp, createEpoch);
126
124
  useEffect(() => {
127
- const current = ownedRuntimeRef.current;
128
- if (current && current.novu !== novu) {
129
- current.runtime.dispose();
125
+ if (sharedRuntime) {
126
+ ownedRuntimeRef.current?.runtime.dispose();
130
127
  ownedRuntimeRef.current = null;
128
+ setManagedRuntime(null);
129
+ return;
131
130
  }
132
- }, [novu]);
133
- const cachedRuntime = useMemo(() => {
134
- if (!webChatReady) {
135
- return null;
136
- }
137
- if (sharedRuntime) {
138
- return sharedRuntime;
131
+ if (!webChatReady || !managedRuntimeKey) {
132
+ setManagedRuntime(null);
133
+ return;
139
134
  }
140
- if (!conversationIdProp) {
141
- return null;
135
+ const key = managedRuntimeKey;
136
+ const current = ownedRuntimeRef.current;
137
+ let runtime2;
138
+ if (current?.novu === novu && current.key === key) {
139
+ runtime2 = current.runtime;
140
+ } else {
141
+ current?.runtime.dispose();
142
+ runtime2 = conversationIdProp ? novu.webChat.conversation({ agentId, conversationId: conversationIdProp, agentHash }) : novu.webChat.conversation({ agentId, agentHash });
143
+ ownedRuntimeRef.current = { key, novu, runtime: runtime2 };
142
144
  }
143
- return novu.webChat.conversation({
144
- agentId,
145
- conversationId: conversationIdProp,
146
- agentHash
147
- });
148
- }, [webChatReady, sharedRuntime, novu, agentId, conversationIdProp, agentHash]);
149
- if (sharedRuntime || conversationIdProp) {
150
- ownedRuntimeRef.current?.runtime.dispose();
151
- ownedRuntimeRef.current = null;
152
- }
153
- const ownedRuntime = !webChatReady || sharedRuntime || conversationIdProp ? null : resolveOwnedRuntime({ novu, agentId, agentHash, ownedRuntimeRef });
154
- const runtime = sharedRuntime ?? cachedRuntime ?? ownedRuntime;
155
- useEffect(() => {
145
+ setManagedRuntime({ key, runtime: runtime2 });
156
146
  return () => {
157
147
  ownedRuntimeRef.current?.runtime.dispose();
158
148
  ownedRuntimeRef.current = null;
149
+ setManagedRuntime(null);
159
150
  };
160
- }, []);
151
+ }, [webChatReady, sharedRuntime, novu, agentId, conversationIdProp, agentHash, createEpoch, managedRuntimeKey]);
152
+ const runtime = sharedRuntime ?? (managedRuntime?.key === managedRuntimeKey ? managedRuntime.runtime : null);
161
153
  const loadNotifiedRef = useRef(false);
162
154
  const replayedActionsRef = useRef(false);
163
155
  const notifiedCatchUpErrorRef = useRef();
@@ -268,6 +260,12 @@ var useWebChat = (props) => {
268
260
  (messageId) => callRuntime((target) => target.retryMessage(messageId)),
269
261
  [callRuntime]
270
262
  );
263
+ const startNewConversation = useCallback(() => {
264
+ if (sharedRuntime || conversationIdProp) {
265
+ return;
266
+ }
267
+ setCreateEpoch((epoch) => epoch + 1);
268
+ }, [sharedRuntime, conversationIdProp]);
271
269
  return {
272
270
  messages: [...snapshot.messages],
273
271
  pendingActions: [...snapshot.pendingActions],
@@ -285,7 +283,8 @@ var useWebChat = (props) => {
285
283
  sendMessage,
286
284
  respondToAction,
287
285
  sendAction,
288
- retryMessage
286
+ retryMessage,
287
+ startNewConversation
289
288
  };
290
289
  };
291
290
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/useWebChat.ts"],"sourcesContent":["import type {\n AgentConversationPublicationMeta,\n AgentConversationRunSnapshot,\n AgentConversationRuntime,\n AgentConversationSnapshot,\n AgentConversationStatus,\n AgentEventEnvelope,\n AgentHashFields,\n AgentMessage,\n AgentPendingAction,\n AgentToolApprovalDecision,\n LoadConversationResult,\n RespondToActionResult,\n SendActionResult,\n SendMessageInput,\n SendMessageResult,\n WebChatPagination,\n WebChatPlanLimitError,\n} from '@novu/js';\nimport { NovuError } from '@novu/js';\nimport { type MutableRefObject, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport { useDataRef } from './internal/useDataRef';\nimport { useNovu } from './NovuProvider';\n\ntype UseWebChatCallbacks = {\n onSuccess?: (data: LoadConversationResult) => void;\n onError?: (error: NovuError | WebChatPlanLimitError) => void;\n /**\n * Fires once when a message id first appears. History pages do not fire.\n * The first event of a turn can create an empty assistant message before text arrives.\n * A send that never reaches the server does not fire. The message status becomes `failed` instead.\n */\n onMessage?: (message: AgentMessage) => void;\n /**\n * Fires once per pending action, including actions still pending on mount.\n * Paging backwards does not fire.\n */\n onActionRequested?: (action: AgentPendingAction) => void;\n /**\n * Live event envelopes for this conversation.\n * Duplicates that the client drops do not fire.\n * Envelopes that arrive before the conversation id exists do not fire.\n * The message list in this render does not include this envelope yet.\n */\n onEvent?: (envelope: AgentEventEnvelope) => void;\n};\n\n/** Arguments for {@link useWebChat}. Pass `agentId`, or pass `conversation`. Do not mix the two. */\nexport type UseWebChatProps = UseWebChatCallbacks &\n AgentHashFields &\n (\n | {\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 */\n conversationId?: string;\n conversation?: never;\n }\n | {\n /** Share an existing conversation runtime across multiple hook instances. */\n conversation: AgentConversationRuntime;\n agentId?: never;\n conversationId?: never;\n agentHash?: never;\n }\n );\n\n/** State and actions returned by {@link useWebChat}. */\nexport type UseWebChatResult = {\n /** Conversation timeline. */\n messages: AgentMessage[];\n /** Tool approvals and MCP connect items that are still pending. */\n pendingActions: AgentPendingAction[];\n /** Server conversation id after create or resume. */\n conversationId?: string;\n /** Last error from load, send, retry, or action. */\n error?: NovuError | WebChatPlanLimitError;\n /** True while Web Chat loads and, for an existing conversation, until the first history fetch completes. */\n isLoading: boolean;\n /** True while the agent turn is in progress. Same as `run.isRunning`. */\n isRunning: boolean;\n /** Typing indicator. Same as `run.typing`. Absent when the agent is not typing. */\n typing?: AgentConversationRunSnapshot['typing'];\n /** `'active'` or `'resolved'`. The agent sets `resolved` with `ctx.resolve()`. Not a loading flag. */\n conversationStatus: AgentConversationStatus;\n /** Current agent-run snapshot. */\n run: AgentConversationRunSnapshot;\n /** Older-history control. Not a top-level `hasMore` or `fetchMore`. */\n pagination: WebChatPagination & {\n fetchMore: () => Promise<{\n data?: { messages: AgentMessage[]; hasMore: boolean };\n error?: NovuError;\n }>;\n };\n /** True while reconnect recovery is in progress. */\n isRecovering: boolean;\n /** Set when reconnect recovery fails. Separate from send and fetch `error`. */\n catchUpError?: NovuError;\n /** Reload the newest history page. No-op when there is no conversation id. */\n refetch: () => Promise<void>;\n /** Send a user message. `input` is a string, or `{ text, metadata }`. Creates a conversation when `conversationId` is omitted. */\n sendMessage: (input: SendMessageInput) => Promise<{\n data?: SendMessageResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /** Resolve a pending `tool-approval`. Pass `action.id` from `pendingActions`. */\n respondToAction: (args: { actionId: string; decision: AgentToolApprovalDecision }) => Promise<{\n data?: RespondToActionResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /** Click a Card button. Do not use this for tool approval. */\n sendAction: (args: { actionId: string; sourceMessageId: string; value?: string }) => Promise<{\n data?: SendActionResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /** Resend a message whose `status` is `failed`. Reuses the original idempotency key. */\n retryMessage: (messageId: string) => Promise<{\n data?: SendMessageResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n};\n\nconst EMPTY_SERVER_SNAPSHOT = {\n key: 'ssr',\n status: 'loading',\n run: { isRunning: false },\n conversationStatus: 'active',\n pagination: { hasMore: false, status: 'idle' },\n messages: [],\n pendingActions: [],\n isRecovering: false,\n} as AgentConversationSnapshot;\n\ntype RuntimeActionResult<T> = {\n data?: T;\n error?: NovuError | WebChatPlanLimitError;\n};\n\nfunction handlePublicationCallbacks(args: {\n snapshot: AgentConversationSnapshot;\n meta: AgentConversationPublicationMeta | undefined;\n conversationIdProp: string | undefined;\n propsRef: ReturnType<typeof useDataRef<UseWebChatProps>>;\n loadNotifiedRef: MutableRefObject<boolean>;\n notifiedCatchUpErrorRef: MutableRefObject<NovuError | undefined>;\n lastReportedErrorKeyRef: MutableRefObject<string | undefined>;\n}): void {\n const {\n snapshot,\n meta,\n conversationIdProp,\n propsRef,\n loadNotifiedRef,\n notifiedCatchUpErrorRef,\n lastReportedErrorKeyRef,\n } = args;\n\n if ((meta?.historyLoaded || meta?.change?.kind === 'history') && !loadNotifiedRef.current && conversationIdProp) {\n if (snapshot.conversationId) {\n loadNotifiedRef.current = true;\n propsRef.current.onSuccess?.({\n conversationId: snapshot.conversationId,\n messages: [...snapshot.messages],\n hasMore: snapshot.pagination.hasMore,\n });\n }\n }\n\n if (snapshot.catchUpError && snapshot.catchUpError !== notifiedCatchUpErrorRef.current) {\n notifiedCatchUpErrorRef.current = snapshot.catchUpError;\n propsRef.current.onError?.(snapshot.catchUpError);\n } else if (!snapshot.catchUpError) {\n notifiedCatchUpErrorRef.current = undefined;\n }\n\n if (snapshot.error) {\n const originalMessage = 'originalError' in snapshot.error ? (snapshot.error.originalError?.message ?? '') : '';\n const errorKey = `${snapshot.error.message}:${originalMessage}`;\n if (lastReportedErrorKeyRef.current !== errorKey) {\n lastReportedErrorKeyRef.current = errorKey;\n propsRef.current.onError?.(snapshot.error as NovuError | WebChatPlanLimitError);\n }\n } else {\n lastReportedErrorKeyRef.current = undefined;\n }\n\n const change = meta?.change;\n if (change?.kind === 'live') {\n propsRef.current.onEvent?.(change.envelope);\n }\n\n if (change && change.kind !== 'history') {\n for (const message of change.addedMessages) {\n propsRef.current.onMessage?.(message);\n }\n }\n\n if (change) {\n for (const action of change.newActions) {\n propsRef.current.onActionRequested?.(action);\n }\n }\n}\n\ntype OwnedRuntimeEntry = {\n key: string;\n novu: ReturnType<typeof useNovu>;\n runtime: AgentConversationRuntime;\n};\n\nfunction getCreateFlowKey(agentId: string, agentHash?: string): string {\n return `${agentId}\\0${agentHash ?? ''}`;\n}\n\nfunction resolveOwnedRuntime(args: {\n novu: ReturnType<typeof useNovu>;\n agentId: string;\n agentHash?: string;\n ownedRuntimeRef: MutableRefObject<OwnedRuntimeEntry | null>;\n}): AgentConversationRuntime | null {\n const key = getCreateFlowKey(args.agentId, args.agentHash);\n const current = args.ownedRuntimeRef.current;\n\n if (current?.novu === args.novu && current.key === key) {\n return current.runtime;\n }\n\n current?.runtime.dispose();\n\n const runtime = args.novu.webChat.conversation({ agentId: args.agentId, agentHash: args.agentHash });\n args.ownedRuntimeRef.current = { key, novu: args.novu, runtime };\n return runtime;\n}\n\ntype WebChatLoadState =\n | { novu: ReturnType<typeof useNovu>; status: 'loading' }\n | { novu: ReturnType<typeof useNovu>; status: 'ready' }\n | { novu: ReturnType<typeof useNovu>; status: 'error'; error: NovuError };\n\nfunction toNovuError(error: unknown): NovuError {\n if (error instanceof NovuError) {\n return error;\n }\n\n if (error instanceof Error) {\n return new NovuError('Failed to load Web Chat', error);\n }\n\n return new NovuError('Failed to load Web Chat', new Error(String(error)));\n}\n\n/**\n * Headless Web Chat client. Use it inside `NovuProvider`.\n *\n * @example\n * ```tsx\n * const { messages, sendMessage, isRunning, isLoading, error } = useWebChat({\n * agentId: 'YOUR_AGENT_IDENTIFIER',\n * });\n * ```\n */\nexport const useWebChat = (props: UseWebChatProps): UseWebChatResult => {\n const novu = useNovu();\n const propsRef = useDataRef(props);\n const [loadState, setLoadState] = useState<WebChatLoadState>(() => ({\n novu,\n status: 'loading',\n }));\n\n useEffect(() => {\n let cancelled = false;\n\n if (!novu.isWebChatLoaded) {\n setLoadState({ novu, status: 'loading' });\n }\n\n void novu\n .loadWebChat()\n .then(() => {\n if (!cancelled) {\n setLoadState({ novu, status: 'ready' });\n }\n })\n .catch((error: unknown) => {\n if (cancelled) {\n return;\n }\n\n const novuError = toNovuError(error);\n propsRef.current.onError?.(novuError);\n setLoadState({ novu, status: 'error', error: novuError });\n });\n\n return () => {\n cancelled = true;\n };\n }, [novu, propsRef]);\n\n const webChatReady = loadState.novu === novu && loadState.status === 'ready';\n const webChatLoadError = loadState.novu === novu && loadState.status === 'error' ? loadState.error : undefined;\n const isWebChatLoading = loadState.novu !== novu || loadState.status === 'loading';\n\n const sharedRuntime = 'conversation' in props ? props.conversation : undefined;\n const agentId = sharedRuntime?.agentId ?? props.agentId!;\n const conversationIdProp = sharedRuntime ? undefined : props.conversationId;\n const agentHash = sharedRuntime ? undefined : props.agentHash;\n\n const ownedRuntimeRef = useRef<OwnedRuntimeEntry | null>(null);\n\n useEffect(() => {\n const current = ownedRuntimeRef.current;\n if (current && current.novu !== novu) {\n current.runtime.dispose();\n ownedRuntimeRef.current = null;\n }\n }, [novu]);\n\n const cachedRuntime = useMemo(() => {\n if (!webChatReady) {\n return null;\n }\n\n if (sharedRuntime) {\n return sharedRuntime;\n }\n\n if (!conversationIdProp) {\n return null;\n }\n\n return novu.webChat.conversation({\n agentId,\n conversationId: conversationIdProp,\n agentHash,\n });\n }, [webChatReady, sharedRuntime, novu, agentId, conversationIdProp, agentHash]);\n\n if (sharedRuntime || conversationIdProp) {\n ownedRuntimeRef.current?.runtime.dispose();\n ownedRuntimeRef.current = null;\n }\n\n const ownedRuntime =\n !webChatReady || sharedRuntime || conversationIdProp\n ? null\n : resolveOwnedRuntime({ novu, agentId, agentHash, ownedRuntimeRef });\n\n const runtime = sharedRuntime ?? cachedRuntime ?? ownedRuntime;\n\n useEffect(() => {\n return () => {\n ownedRuntimeRef.current?.runtime.dispose();\n ownedRuntimeRef.current = null;\n };\n }, []);\n\n const loadNotifiedRef = useRef(false);\n const replayedActionsRef = useRef(false);\n const notifiedCatchUpErrorRef = useRef<NovuError | undefined>();\n const lastReportedErrorKeyRef = useRef<string>();\n\n useEffect(() => {\n loadNotifiedRef.current = false;\n replayedActionsRef.current = false;\n notifiedCatchUpErrorRef.current = undefined;\n lastReportedErrorKeyRef.current = undefined;\n }, [runtime]);\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n if (!runtime) {\n return () => {};\n }\n\n if (!replayedActionsRef.current) {\n replayedActionsRef.current = true;\n for (const action of runtime.getSnapshot().pendingActions) {\n propsRef.current.onActionRequested?.(action);\n }\n }\n\n return runtime.subscribe((snapshot, meta) => {\n onStoreChange();\n handlePublicationCallbacks({\n snapshot,\n meta,\n conversationIdProp,\n propsRef,\n loadNotifiedRef,\n notifiedCatchUpErrorRef,\n lastReportedErrorKeyRef,\n });\n });\n },\n [runtime, conversationIdProp, propsRef]\n );\n\n const getSnapshot = useCallback(() => {\n return runtime?.getSnapshot() ?? EMPTY_SERVER_SNAPSHOT;\n }, [runtime]);\n\n const getServerSnapshot = useCallback(() => {\n return runtime?.getServerSnapshot() ?? EMPTY_SERVER_SNAPSHOT;\n }, [runtime]);\n\n const snapshot = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n\n const callRuntime = useCallback(\n async <T>(action: (target: AgentConversationRuntime) => Promise<RuntimeActionResult<T>>) => {\n if (!runtime) {\n const error =\n webChatLoadError ??\n new NovuError(\n isWebChatLoading ? 'Web Chat is still loading' : 'Web Chat runtime is unavailable',\n new Error('Web Chat runtime is not ready')\n );\n propsRef.current.onError?.(error);\n\n return { error };\n }\n\n const response = await action(runtime);\n if (response.error) {\n propsRef.current.onError?.(response.error);\n }\n\n return response;\n },\n [runtime, webChatLoadError, isWebChatLoading, propsRef]\n );\n\n const refetch = useCallback(async () => {\n if (!runtime) {\n return;\n }\n\n const response = await runtime.load();\n if (response.data) {\n propsRef.current.onSuccess?.({\n conversationId: response.data.conversationId,\n messages: [...response.data.messages],\n hasMore: response.data.hasMore,\n });\n }\n }, [runtime, propsRef]);\n\n const fetchMore = useCallback(async () => {\n const response = await callRuntime((target) => target.fetchMore());\n\n return {\n ...response,\n error: response.error as NovuError | undefined,\n data: response.data\n ? {\n messages: [...response.data.messages],\n hasMore: response.data.hasMore,\n }\n : undefined,\n };\n }, [callRuntime]);\n\n const paginationWithFetch = useMemo(\n () => ({\n status: snapshot.pagination.status,\n hasMore: snapshot.pagination.hasMore,\n fetchMore,\n }),\n [snapshot.pagination.status, snapshot.pagination.hasMore, fetchMore]\n );\n\n const sendMessage = useCallback(\n (input: SendMessageInput) => callRuntime((target) => target.sendMessage(input)),\n [callRuntime]\n );\n const respondToAction = useCallback(\n (args: { actionId: string; decision: AgentToolApprovalDecision }) =>\n callRuntime((target) => target.respondToAction(args)),\n [callRuntime]\n );\n const sendAction = useCallback(\n (args: { actionId: string; sourceMessageId: string; value?: string }) =>\n callRuntime((target) => target.sendAction(args)),\n [callRuntime]\n );\n const retryMessage = useCallback(\n (messageId: string) => callRuntime((target) => target.retryMessage(messageId)),\n [callRuntime]\n );\n\n return {\n messages: [...snapshot.messages],\n pendingActions: [...snapshot.pendingActions],\n conversationId: snapshot.conversationId,\n error: webChatLoadError ?? (snapshot.error as UseWebChatResult['error']),\n isLoading: !webChatLoadError && (isWebChatLoading || snapshot.status === 'loading'),\n isRunning: snapshot.run.isRunning,\n typing: snapshot.run.typing,\n conversationStatus: snapshot.conversationStatus,\n run: snapshot.run,\n pagination: paginationWithFetch,\n isRecovering: snapshot.isRecovering,\n catchUpError: snapshot.catchUpError,\n refetch,\n sendMessage,\n respondToAction,\n sendAction,\n retryMessage,\n };\n};\n"],"mappings":";AAmBA,SAAS,iBAAiB;AAC1B,SAAgC,aAAa,WAAW,SAAS,QAAQ,UAAU,4BAA4B;AAC/G,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AAsGxB,IAAM,wBAAwB;AAAA,EAC5B,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,KAAK,EAAE,WAAW,MAAM;AAAA,EACxB,oBAAoB;AAAA,EACpB,YAAY,EAAE,SAAS,OAAO,QAAQ,OAAO;AAAA,EAC7C,UAAU,CAAC;AAAA,EACX,gBAAgB,CAAC;AAAA,EACjB,cAAc;AAChB;AAOA,SAAS,2BAA2B,MAQ3B;AACP,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,OAAK,MAAM,iBAAiB,MAAM,QAAQ,SAAS,cAAc,CAAC,gBAAgB,WAAW,oBAAoB;AAC/G,QAAI,SAAS,gBAAgB;AAC3B,sBAAgB,UAAU;AAC1B,eAAS,QAAQ,YAAY;AAAA,QAC3B,gBAAgB,SAAS;AAAA,QACzB,UAAU,CAAC,GAAG,SAAS,QAAQ;AAAA,QAC/B,SAAS,SAAS,WAAW;AAAA,MAC/B,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,SAAS,gBAAgB,SAAS,iBAAiB,wBAAwB,SAAS;AACtF,4BAAwB,UAAU,SAAS;AAC3C,aAAS,QAAQ,UAAU,SAAS,YAAY;AAAA,EAClD,WAAW,CAAC,SAAS,cAAc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A,EACd;AAEA,SAAO;AAAA,IACL,UAAU,CAAC,GAAG,SAAS,QAAQ;AAAA,IAC/B,gBAAgB,CAAC,GAAG,SAAS,cAAc;AAAA,IAC3C,gBAAgB,SAAS;AAAA,IACzB,OAAO,oBAAqB,SAAS;AAAA,IACrC,WAAW,CAAC,qBAAqB,oBAAoB,SAAS,WAAW;AAAA,IACzE,WAAW,SAAS,IAAI;AAAA,IACxB,QAAQ,SAAS,IAAI;AAAA,IACrB,oBAAoB,SAAS;AAAA,IAC7B,KAAK,SAAS;AAAA,IACd,YAAY;AAAA,IACZ,cAAc,SAAS;AAAA,IACvB,cAAc,SAAS;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["snapshot"]}
1
+ {"version":3,"sources":["../../../src/hooks/useWebChat.ts"],"sourcesContent":["import type {\n AgentConversationPublicationMeta,\n AgentConversationRunSnapshot,\n AgentConversationRuntime,\n AgentConversationSnapshot,\n AgentConversationStatus,\n AgentEventEnvelope,\n AgentHashFields,\n AgentMessage,\n AgentPendingAction,\n AgentToolApprovalDecision,\n LoadConversationResult,\n RespondToActionResult,\n SendActionResult,\n SendMessageInput,\n SendMessageResult,\n WebChatPagination,\n WebChatPlanLimitError,\n} from '@novu/js';\nimport { NovuError } from '@novu/js';\nimport { type MutableRefObject, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport { useDataRef } from './internal/useDataRef';\nimport { useNovu } from './NovuProvider';\n\ntype UseWebChatCallbacks = {\n onSuccess?: (data: LoadConversationResult) => void;\n onError?: (error: NovuError | WebChatPlanLimitError) => void;\n /**\n * Fires once when a message id first appears. History pages do not fire.\n * The first event of a turn can create an empty assistant message before text arrives.\n * A send that never reaches the server does not fire. The message status becomes `failed` instead.\n */\n onMessage?: (message: AgentMessage) => void;\n /**\n * Fires once per pending action, including actions still pending on mount.\n * Paging backwards does not fire.\n */\n onActionRequested?: (action: AgentPendingAction) => void;\n /**\n * Live event envelopes for this conversation.\n * Duplicates that the client drops do not fire.\n * Envelopes that arrive before the conversation id exists do not fire.\n * The message list in this render does not include this envelope yet.\n */\n onEvent?: (envelope: AgentEventEnvelope) => void;\n};\n\n/** Arguments for {@link useWebChat}. Pass `agentId`, or pass `conversation`. Do not mix the two. */\nexport type UseWebChatProps = UseWebChatCallbacks &\n AgentHashFields &\n (\n | {\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 */\n conversationId?: string;\n conversation?: never;\n }\n | {\n /** Share an existing conversation runtime across multiple hook instances. */\n conversation: AgentConversationRuntime;\n agentId?: never;\n conversationId?: never;\n agentHash?: never;\n }\n );\n\n/**\n * State and actions returned by {@link useWebChat}.\n * `sendMessage`, `respondToAction`, `sendAction`, and `retryMessage` resolve `{ data, error }` and never reject.\n * Inspect `error` on the result, or show hook `error`.\n */\nexport type UseWebChatResult = {\n /** Conversation timeline. */\n messages: AgentMessage[];\n /** Tool approvals and MCP connect items that are still pending. */\n pendingActions: AgentPendingAction[];\n /** Server conversation id after create or resume. */\n conversationId?: string;\n /** Last error from load, send, retry, or action. Mutations also return `{ error }` for that call. */\n error?: NovuError | WebChatPlanLimitError;\n /** True while Web Chat loads and, for an existing conversation, until the first history fetch completes. */\n isLoading: boolean;\n /** True while the agent turn is in progress. Same as `run.isRunning`. */\n isRunning: boolean;\n /** Typing indicator. Same as `run.typing`. Absent when the agent is not typing. */\n typing?: AgentConversationRunSnapshot['typing'];\n /** `'active'` or `'resolved'`. The agent sets `resolved` with `ctx.resolve()`. Not a loading flag. */\n conversationStatus: AgentConversationStatus;\n /** Current agent-run snapshot. */\n run: AgentConversationRunSnapshot;\n /** Older-history control. Not a top-level `hasMore` or `fetchMore`. */\n pagination: WebChatPagination & {\n fetchMore: () => Promise<{\n data?: { messages: AgentMessage[]; hasMore: boolean };\n error?: NovuError;\n }>;\n };\n /** True while reconnect recovery is in progress. */\n isRecovering: boolean;\n /** Set when reconnect recovery fails. Separate from send and fetch `error`. */\n catchUpError?: NovuError;\n /** Reload the newest history page. No-op when there is no conversation id. */\n refetch: () => Promise<void>;\n /**\n * Send a user message. `input` is a string, or `{ text, metadata }`. Creates a conversation when `conversationId` is omitted.\n * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.\n */\n sendMessage: (input: SendMessageInput) => Promise<{\n data?: SendMessageResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /**\n * Resolve a pending `approval`. Pass `approvalId` from `pendingActions` or message parts.\n * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.\n */\n respondToAction: (args: { approvalId: string; decision: AgentToolApprovalDecision }) => Promise<{\n data?: RespondToActionResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /**\n * Click a Card button. Do not use this for tool approval.\n * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.\n */\n sendAction: (args: { actionId: string; sourceMessageId: string; value?: string }) => Promise<{\n data?: SendActionResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /**\n * Resend a message whose `status` is `failed`. Reuses the original idempotency key.\n * Does not throw. Resolves `{ data, error }`. Inspect `error` on the result, or show hook `error`.\n */\n retryMessage: (messageId: string) => Promise<{\n data?: SendMessageResult;\n error?: NovuError | WebChatPlanLimitError;\n }>;\n /**\n * Start a new empty chat for the current `agentId`. The next `sendMessage` creates the server conversation.\n * No-op when `conversationId` or `conversation` is provided.\n */\n startNewConversation: () => void;\n};\n\nconst EMPTY_SERVER_SNAPSHOT = {\n key: 'ssr',\n status: 'loading',\n run: { isRunning: false },\n conversationStatus: 'active',\n pagination: { hasMore: false, status: 'idle' },\n messages: [],\n pendingActions: [],\n isRecovering: false,\n} as AgentConversationSnapshot;\n\ntype RuntimeActionResult<T> = {\n data?: T;\n error?: NovuError | WebChatPlanLimitError;\n};\n\nfunction handlePublicationCallbacks(args: {\n snapshot: AgentConversationSnapshot;\n meta: AgentConversationPublicationMeta | undefined;\n conversationIdProp: string | undefined;\n propsRef: ReturnType<typeof useDataRef<UseWebChatProps>>;\n loadNotifiedRef: MutableRefObject<boolean>;\n notifiedCatchUpErrorRef: MutableRefObject<NovuError | undefined>;\n lastReportedErrorKeyRef: MutableRefObject<string | undefined>;\n}): void {\n const {\n snapshot,\n meta,\n conversationIdProp,\n propsRef,\n loadNotifiedRef,\n notifiedCatchUpErrorRef,\n lastReportedErrorKeyRef,\n } = args;\n\n if ((meta?.historyLoaded || meta?.change?.kind === 'history') && !loadNotifiedRef.current && conversationIdProp) {\n if (snapshot.conversationId) {\n loadNotifiedRef.current = true;\n propsRef.current.onSuccess?.({\n conversationId: snapshot.conversationId,\n messages: [...snapshot.messages],\n hasMore: snapshot.pagination.hasMore,\n });\n }\n }\n\n if (snapshot.catchUpError && snapshot.catchUpError !== notifiedCatchUpErrorRef.current) {\n notifiedCatchUpErrorRef.current = snapshot.catchUpError;\n propsRef.current.onError?.(snapshot.catchUpError);\n } else if (!snapshot.catchUpError) {\n notifiedCatchUpErrorRef.current = undefined;\n }\n\n if (snapshot.error) {\n const originalMessage = 'originalError' in snapshot.error ? (snapshot.error.originalError?.message ?? '') : '';\n const errorKey = `${snapshot.error.message}:${originalMessage}`;\n if (lastReportedErrorKeyRef.current !== errorKey) {\n lastReportedErrorKeyRef.current = errorKey;\n propsRef.current.onError?.(snapshot.error as NovuError | WebChatPlanLimitError);\n }\n } else {\n lastReportedErrorKeyRef.current = undefined;\n }\n\n const change = meta?.change;\n if (change?.kind === 'live') {\n propsRef.current.onEvent?.(change.envelope);\n }\n\n if (change && change.kind !== 'history') {\n for (const message of change.addedMessages) {\n propsRef.current.onMessage?.(message);\n }\n }\n\n if (change) {\n for (const action of change.newActions) {\n propsRef.current.onActionRequested?.(action);\n }\n }\n}\n\ntype OwnedRuntimeEntry = {\n key: string;\n novu: ReturnType<typeof useNovu>;\n runtime: AgentConversationRuntime;\n};\n\nfunction getCreateFlowKey(agentId: string, agentHash?: string): string {\n return `${agentId}\\0${agentHash ?? ''}`;\n}\n\nfunction getManagedRuntimeKey(\n agentId: string,\n agentHash: string | undefined,\n conversationIdProp: string | undefined,\n createEpoch: number\n): string {\n if (conversationIdProp) {\n return `resume:${agentId}\\0${agentHash ?? ''}\\0${conversationIdProp}`;\n }\n\n return `${getCreateFlowKey(agentId, agentHash)}\\0${createEpoch}`;\n}\n\ntype ManagedRuntimeEntry = {\n key: string;\n runtime: AgentConversationRuntime;\n};\n\ntype WebChatLoadState =\n | { novu: ReturnType<typeof useNovu>; status: 'loading' }\n | { novu: ReturnType<typeof useNovu>; status: 'ready' }\n | { novu: ReturnType<typeof useNovu>; status: 'error'; error: NovuError };\n\nfunction toNovuError(error: unknown): NovuError {\n if (error instanceof NovuError) {\n return error;\n }\n\n if (error instanceof Error) {\n return new NovuError('Failed to load Web Chat', error);\n }\n\n return new NovuError('Failed to load Web Chat', new Error(String(error)));\n}\n\n/**\n * Headless Web Chat client. Use it inside `NovuProvider`.\n *\n * @example\n * ```tsx\n * const { messages, sendMessage, isRunning, isLoading, error } = useWebChat({\n * agentId: 'YOUR_AGENT_IDENTIFIER',\n * });\n * ```\n */\nexport const useWebChat = (props: UseWebChatProps): UseWebChatResult => {\n const novu = useNovu();\n const propsRef = useDataRef(props);\n const [loadState, setLoadState] = useState<WebChatLoadState>(() => ({\n novu,\n status: 'loading',\n }));\n\n useEffect(() => {\n let cancelled = false;\n\n if (!novu.isWebChatLoaded) {\n setLoadState({ novu, status: 'loading' });\n }\n\n void novu\n .loadWebChat()\n .then(() => {\n if (!cancelled) {\n setLoadState({ novu, status: 'ready' });\n }\n })\n .catch((error: unknown) => {\n if (cancelled) {\n return;\n }\n\n const novuError = toNovuError(error);\n propsRef.current.onError?.(novuError);\n setLoadState({ novu, status: 'error', error: novuError });\n });\n\n return () => {\n cancelled = true;\n };\n }, [novu, propsRef]);\n\n const webChatReady = loadState.novu === novu && loadState.status === 'ready';\n const webChatLoadError = loadState.novu === novu && loadState.status === 'error' ? loadState.error : undefined;\n const isWebChatLoading = loadState.novu !== novu || loadState.status === 'loading';\n\n const sharedRuntime = 'conversation' in props ? props.conversation : undefined;\n const agentId = sharedRuntime?.agentId ?? props.agentId!;\n const conversationIdProp = sharedRuntime ? undefined : props.conversationId;\n const agentHash = sharedRuntime ? undefined : props.agentHash;\n\n const ownedRuntimeRef = useRef<OwnedRuntimeEntry | null>(null);\n const [managedRuntime, setManagedRuntime] = useState<ManagedRuntimeEntry | null>(null);\n const [createEpoch, setCreateEpoch] = useState(0);\n const managedRuntimeKey = sharedRuntime\n ? null\n : getManagedRuntimeKey(agentId, agentHash, conversationIdProp, createEpoch);\n\n useEffect(() => {\n if (sharedRuntime) {\n ownedRuntimeRef.current?.runtime.dispose();\n ownedRuntimeRef.current = null;\n setManagedRuntime(null);\n\n return;\n }\n\n if (!webChatReady || !managedRuntimeKey) {\n setManagedRuntime(null);\n\n return;\n }\n\n const key = managedRuntimeKey;\n const current = ownedRuntimeRef.current;\n\n let runtime: AgentConversationRuntime;\n if (current?.novu === novu && current.key === key) {\n runtime = current.runtime;\n } else {\n current?.runtime.dispose();\n runtime = conversationIdProp\n ? novu.webChat.conversation({ agentId, conversationId: conversationIdProp, agentHash })\n : novu.webChat.conversation({ agentId, agentHash });\n ownedRuntimeRef.current = { key, novu, runtime };\n }\n\n setManagedRuntime({ key, runtime });\n\n return () => {\n ownedRuntimeRef.current?.runtime.dispose();\n ownedRuntimeRef.current = null;\n setManagedRuntime(null);\n };\n }, [webChatReady, sharedRuntime, novu, agentId, conversationIdProp, agentHash, createEpoch, managedRuntimeKey]);\n\n const runtime =\n sharedRuntime ?? (managedRuntime?.key === managedRuntimeKey ? managedRuntime.runtime : null);\n\n const loadNotifiedRef = useRef(false);\n const replayedActionsRef = useRef(false);\n const notifiedCatchUpErrorRef = useRef<NovuError | undefined>();\n const lastReportedErrorKeyRef = useRef<string>();\n\n useEffect(() => {\n loadNotifiedRef.current = false;\n replayedActionsRef.current = false;\n notifiedCatchUpErrorRef.current = undefined;\n lastReportedErrorKeyRef.current = undefined;\n }, [runtime]);\n\n const subscribe = useCallback(\n (onStoreChange: () => void) => {\n if (!runtime) {\n return () => {};\n }\n\n if (!replayedActionsRef.current) {\n replayedActionsRef.current = true;\n for (const action of runtime.getSnapshot().pendingActions) {\n propsRef.current.onActionRequested?.(action);\n }\n }\n\n return runtime.subscribe((snapshot, meta) => {\n onStoreChange();\n handlePublicationCallbacks({\n snapshot,\n meta,\n conversationIdProp,\n propsRef,\n loadNotifiedRef,\n notifiedCatchUpErrorRef,\n lastReportedErrorKeyRef,\n });\n });\n },\n [runtime, conversationIdProp, propsRef]\n );\n\n const getSnapshot = useCallback(() => {\n return runtime?.getSnapshot() ?? EMPTY_SERVER_SNAPSHOT;\n }, [runtime]);\n\n const getServerSnapshot = useCallback(() => {\n return runtime?.getServerSnapshot() ?? EMPTY_SERVER_SNAPSHOT;\n }, [runtime]);\n\n const snapshot = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n\n const callRuntime = useCallback(\n async <T>(action: (target: AgentConversationRuntime) => Promise<RuntimeActionResult<T>>) => {\n if (!runtime) {\n const error =\n webChatLoadError ??\n new NovuError(\n isWebChatLoading ? 'Web Chat is still loading' : 'Web Chat runtime is unavailable',\n new Error('Web Chat runtime is not ready')\n );\n propsRef.current.onError?.(error);\n\n return { error };\n }\n\n const response = await action(runtime);\n if (response.error) {\n propsRef.current.onError?.(response.error);\n }\n\n return response;\n },\n [runtime, webChatLoadError, isWebChatLoading, propsRef]\n );\n\n const refetch = useCallback(async () => {\n if (!runtime) {\n return;\n }\n\n const response = await runtime.load();\n if (response.data) {\n propsRef.current.onSuccess?.({\n conversationId: response.data.conversationId,\n messages: [...response.data.messages],\n hasMore: response.data.hasMore,\n });\n }\n }, [runtime, propsRef]);\n\n const fetchMore = useCallback(async () => {\n const response = await callRuntime((target) => target.fetchMore());\n\n return {\n ...response,\n error: response.error as NovuError | undefined,\n data: response.data\n ? {\n messages: [...response.data.messages],\n hasMore: response.data.hasMore,\n }\n : undefined,\n };\n }, [callRuntime]);\n\n const paginationWithFetch = useMemo(\n () => ({\n status: snapshot.pagination.status,\n hasMore: snapshot.pagination.hasMore,\n fetchMore,\n }),\n [snapshot.pagination.status, snapshot.pagination.hasMore, fetchMore]\n );\n\n const sendMessage = useCallback(\n (input: SendMessageInput) => callRuntime((target) => target.sendMessage(input)),\n [callRuntime]\n );\n const respondToAction = useCallback(\n (args: { approvalId: string; decision: AgentToolApprovalDecision }) =>\n callRuntime((target) => target.respondToAction(args)),\n [callRuntime]\n );\n const sendAction = useCallback(\n (args: { actionId: string; sourceMessageId: string; value?: string }) =>\n callRuntime((target) => target.sendAction(args)),\n [callRuntime]\n );\n const retryMessage = useCallback(\n (messageId: string) => callRuntime((target) => target.retryMessage(messageId)),\n [callRuntime]\n );\n const startNewConversation = useCallback(() => {\n if (sharedRuntime || conversationIdProp) {\n return;\n }\n\n setCreateEpoch((epoch) => epoch + 1);\n }, [sharedRuntime, conversationIdProp]);\n\n return {\n messages: [...snapshot.messages],\n pendingActions: [...snapshot.pendingActions],\n conversationId: snapshot.conversationId,\n error: webChatLoadError ?? (snapshot.error as UseWebChatResult['error']),\n isLoading: !webChatLoadError && (isWebChatLoading || snapshot.status === 'loading'),\n isRunning: snapshot.run.isRunning,\n typing: snapshot.run.typing,\n conversationStatus: snapshot.conversationStatus,\n run: snapshot.run,\n pagination: paginationWithFetch,\n isRecovering: snapshot.isRecovering,\n catchUpError: snapshot.catchUpError,\n refetch,\n sendMessage,\n respondToAction,\n sendAction,\n retryMessage,\n startNewConversation,\n };\n};\n"],"mappings":";AAmBA,SAAS,iBAAiB;AAC1B,SAAgC,aAAa,WAAW,SAAS,QAAQ,UAAU,4BAA4B;AAC/G,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AA2HxB,IAAM,wBAAwB;AAAA,EAC5B,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,KAAK,EAAE,WAAW,MAAM;AAAA,EACxB,oBAAoB;AA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ACvB,cAAc,SAAS;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["runtime","snapshot"]}
@@ -1,5 +1,5 @@
1
1
  export * from '@novu/js';
2
- export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';
2
+ export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum, pendingActionKey } from '@novu/js';
3
3
  export { AllLocalization, AllLocalizationKey, ChannelConnectButtonIconKey, ElementStyles, InboxAppearance, InboxAppearanceCallback, InboxAppearanceCallbackFunction, InboxAppearanceCallbackKeys, InboxAppearanceKey, InboxElements, InboxLocalization, InboxLocalizationKey, InboxTheme, NotificationActionClickHandler, NotificationClickHandler, NotificationRenderer, PreferenceGroups, PreferencesFilter, RouterPush, SubscriptionAppearance, SubscriptionAppearanceCallback, SubscriptionAppearanceCallbackFunction, SubscriptionAppearanceCallbackKeys, SubscriptionAppearanceKey, SubscriptionElements, SubscriptionLocalization, SubscriptionLocalizationKey, SubscriptionTheme, Tab, Variables } from '@novu/js/ui';
4
4
  export { NovuProvider, NovuProviderProps, useNovu } from './hooks/NovuProvider.js';
5
5
  export { Bell, BellProps } from './components/Bell.js';
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- import { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from "@novu/js";
2
+ import { pendingActionKey, PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from "@novu/js";
3
3
  import {
4
4
  Bell,
5
5
  Inbox,
@@ -53,6 +53,7 @@ export {
53
53
  SubscriptionPreferences,
54
54
  TelegramConnectButton,
55
55
  WorkflowCriticalityEnum,
56
+ pendingActionKey,
56
57
  useChannelConnection,
57
58
  useChannelConnections,
58
59
  useChannelEndpoint,
@@ -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 UseWebChatProps,\n UseWebChatResult,\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 useWebChat,\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":";AACA,SAAS,iBAAiB,mBAAmB,+BAA+B;AAiD5E;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAuBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type * from '@novu/js';\nexport { pendingActionKey, 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 UseWebChatProps,\n UseWebChatResult,\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 useWebChat,\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":";AACA,SAAS,kBAAkB,iBAAiB,mBAAmB,+BAA+B;AAiD9F;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAuBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { InboxProps } from '../components/Inbox.js';
3
3
  export * from '@novu/js';
4
- export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from '@novu/js';
4
+ export { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum, pendingActionKey } from '@novu/js';
5
5
  import { NovuProviderProps } from '../hooks/NovuProvider.js';
6
6
  import { UseWebChatProps, UseWebChatResult } from '../hooks/useWebChat.js';
7
7
  import { UseCountsProps, UseCountsResult } from '../hooks/useCounts.js';
@@ -1,6 +1,6 @@
1
1
  // src/server/index.tsx
2
2
  import { ShadowRootDetector } from "../components/ShadowRootDetector.js";
3
- import { PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from "@novu/js";
3
+ import { pendingActionKey, PreferenceLevel, SeverityLevelEnum, WorkflowCriticalityEnum } from "@novu/js";
4
4
  import { Fragment, jsx } from "react/jsx-runtime";
5
5
  function Inbox(props) {
6
6
  return /* @__PURE__ */ jsx(ShadowRootDetector, {});
@@ -61,7 +61,9 @@ function useWebChat(_) {
61
61
  sendMessage: () => Promise.resolve({ data: void 0, error: void 0 }),
62
62
  respondToAction: () => Promise.resolve({ data: void 0, error: void 0 }),
63
63
  sendAction: () => Promise.resolve({ data: void 0, error: void 0 }),
64
- retryMessage: () => Promise.resolve({ data: void 0, error: void 0 })
64
+ retryMessage: () => Promise.resolve({ data: void 0, error: void 0 }),
65
+ startNewConversation: () => {
66
+ }
65
67
  };
66
68
  }
67
69
  function useCounts(_) {
@@ -151,6 +153,7 @@ export {
151
153
  SubscriptionPreferences,
152
154
  TelegramConnectButton,
153
155
  WorkflowCriticalityEnum,
156
+ pendingActionKey,
154
157
  useCounts,
155
158
  useCreateSubscription,
156
159
  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 UseWebChatProps,\n UseWebChatResult,\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 useWebChat(_: UseWebChatProps): UseWebChatResult {\n return {\n messages: [],\n pendingActions: [],\n isLoading: true,\n isRunning: false,\n typing: undefined,\n conversationStatus: 'active',\n run: { isRunning: false },\n pagination: {\n status: 'idle',\n hasMore: false,\n fetchMore: () => Promise.resolve({ data: undefined, error: undefined }),\n },\n isRecovering: false,\n catchUpError: undefined,\n refetch: () => Promise.resolve(),\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 retryMessage: () => 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 UseWebChatProps,\n UseWebChatResult,\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":";AACA,SAAS,0BAA0B;AAqLnC,SAAS,iBAAiB,mBAAmB,+BAA+B;AAtJnE,SAYA,UAZA;AADF,SAAS,MAAM,OAAmB;AACvC,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,eAAe;AAAC;AAEzB,SAAS,gBAAgB;AAAC;AAE1B,SAAS,cAAc;AAAC;AAExB,SAAS,OAAO;AAAC;AAEjB,SAAS,aAAa,OAA0B;AACrD,SAAO,gCAAG,gBAAM,UAAS;AAC3B;AAEO,SAAS,eAAe;AAC7B,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,qBAAqB;AAAC;AAE/B,SAAS,0BAA0B;AAAC;AAEpC,SAAS,qBAAqB;AACnC,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,gBAAgB;AAC9B,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,uBAAuB;AACrC,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,kBAAkB;AAChC,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,wBAAwB;AACtC,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,U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":["import type { InboxProps } from '../components/Inbox';\nimport { ShadowRootDetector } from '../components/ShadowRootDetector';\nimport type {\n UseWebChatProps,\n UseWebChatResult,\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 useWebChat(_: UseWebChatProps): UseWebChatResult {\n return {\n messages: [],\n pendingActions: [],\n isLoading: true,\n isRunning: false,\n typing: undefined,\n conversationStatus: 'active',\n run: { isRunning: false },\n pagination: {\n status: 'idle',\n hasMore: false,\n fetchMore: () => Promise.resolve({ data: undefined, error: undefined }),\n },\n isRecovering: false,\n catchUpError: undefined,\n refetch: () => Promise.resolve(),\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 retryMessage: () => Promise.resolve({ data: undefined, error: undefined }),\n startNewConversation: () => {},\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 { pendingActionKey, 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 UseWebChatProps,\n UseWebChatResult,\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":";AACA,SAAS,0BAA0B;AAsLnC,SAAS,kBAAkB,iBAAiB,mBAAmB,+BAA+B;AAvJrF,SAYA,UAZA;AADF,SAAS,MAAM,OAAmB;AACvC,SAAO,oBAAC,sBAAmB;AAC7B;AAEO,SAAS,eAAe;A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,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,sBAAsB,IAAgC,CAAC,GAAgC;AACrG,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,QAAQ,MAAM,QAAQ,QAAQ,EAAE,MAAM,QAAW,OAAO,OAAU,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,iBAAiB,GAAkD;AACjF,SAAO;AAAA,IACL,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,EACjC;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novu/react",
3
- "version": "3.19.1",
3
+ "version": "3.19.2-rc.dc9caee828",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/novuhq/novu",
@@ -121,7 +121,7 @@
121
121
  }
122
122
  },
123
123
  "dependencies": {
124
- "@novu/js": "3.19.1"
124
+ "@novu/js": "3.19.2-rc.dc9caee828"
125
125
  },
126
126
  "nx": {
127
127
  "tags": [