@inkeep/agents-ui 0.15.13 → 0.15.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +230 -222
- package/dist/primitives/atoms/icons/built-in-icons.cjs +1 -1
- package/dist/primitives/atoms/icons/built-in-icons.d.ts +2 -0
- package/dist/primitives/atoms/icons/built-in-icons.js +33 -31
- package/dist/primitives/atoms/icons/inkeep-default-icons.cjs +1 -1
- package/dist/primitives/atoms/icons/inkeep-default-icons.js +4 -1
- package/dist/primitives/components/chat-history/index.cjs +1 -0
- package/dist/primitives/components/chat-history/index.d.ts +27 -0
- package/dist/primitives/components/chat-history/index.js +105 -0
- package/dist/primitives/components/embedded-chat/use-captcha.cjs +1 -0
- package/dist/primitives/components/embedded-chat/use-captcha.d.ts +23 -6
- package/dist/primitives/components/embedded-chat/use-captcha.js +67 -0
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +12 -3
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +252 -144
- package/dist/primitives/components/embedded-chat/use-stream-processor.cjs +1 -1
- package/dist/primitives/components/embedded-chat/use-stream-processor.d.ts +2 -0
- package/dist/primitives/components/embedded-chat/use-stream-processor.js +120 -70
- package/dist/primitives/components/embedded-chat.cjs +3 -3
- package/dist/primitives/components/embedded-chat.d.ts +5 -2
- package/dist/primitives/components/embedded-chat.js +1010 -967
- package/dist/primitives/components/index.cjs +1 -1
- package/dist/primitives/components/index.d.ts +1 -0
- package/dist/primitives/components/index.js +20 -18
- package/dist/primitives/hooks/use-anonymous-session.cjs +1 -0
- package/dist/primitives/hooks/use-anonymous-session.d.ts +12 -0
- package/dist/primitives/hooks/use-anonymous-session.js +57 -0
- package/dist/primitives/hooks/use-conversation-loader.cjs +1 -0
- package/dist/primitives/hooks/use-conversation-loader.d.ts +13 -0
- package/dist/primitives/hooks/use-conversation-loader.js +36 -0
- package/dist/primitives/hooks/use-inkeep-api-client.cjs +1 -0
- package/dist/primitives/hooks/use-inkeep-api-client.d.ts +33 -0
- package/dist/primitives/hooks/use-inkeep-api-client.js +87 -0
- package/dist/primitives/hooks/use-local-storage.cjs +1 -0
- package/dist/primitives/hooks/use-local-storage.d.ts +8 -0
- package/dist/primitives/hooks/use-local-storage.js +26 -0
- package/dist/primitives/index.cjs +1 -1
- package/dist/primitives/index.js +157 -151
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.js +1 -1
- package/dist/primitives/providers/chat-history-provider.cjs +1 -0
- package/dist/primitives/providers/chat-history-provider.d.ts +32 -0
- package/dist/primitives/providers/chat-history-provider.js +105 -0
- package/dist/primitives/providers/index.cjs +1 -1
- package/dist/primitives/providers/index.d.ts +1 -0
- package/dist/primitives/providers/index.js +55 -52
- package/dist/primitives/utils/component-ids.cjs +1 -1
- package/dist/primitives/utils/component-ids.d.ts +32 -0
- package/dist/primitives/utils/component-ids.js +19 -1
- package/dist/primitives/utils/default-settings.cjs +1 -1
- package/dist/primitives/utils/default-settings.d.ts +2 -0
- package/dist/primitives/utils/default-settings.js +6 -4
- package/dist/react/chat-button.cjs +1 -1
- package/dist/react/chat-button.js +42 -38
- package/dist/react/embedded-chat.cjs +1 -1
- package/dist/react/embedded-chat.js +256 -230
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +230 -222
- package/dist/react/sidebar-chat.cjs +1 -1
- package/dist/react/sidebar-chat.js +26 -22
- package/dist/styled/components/chat-bubble.cjs +1 -1
- package/dist/styled/components/chat-bubble.js +1 -1
- package/dist/styled/components/chat-history.cjs +1 -0
- package/dist/styled/components/chat-history.d.ts +15 -0
- package/dist/styled/components/chat-history.js +197 -0
- package/dist/styled/components/data-summary-group.cjs +1 -1
- package/dist/styled/components/data-summary-group.js +24 -24
- package/dist/styled/components/embedded-chat/session-loading.cjs +1 -0
- package/dist/styled/components/embedded-chat/session-loading.d.ts +1 -0
- package/dist/styled/components/embedded-chat/session-loading.js +26 -0
- package/dist/styled/components/embedded-chat.cjs +1 -1
- package/dist/styled/components/embedded-chat.d.ts +7 -1
- package/dist/styled/components/embedded-chat.js +615 -563
- package/dist/styled/components/embedded-search.cjs +1 -1
- package/dist/styled/components/embedded-search.js +1 -1
- package/dist/styled/components/index.cjs +1 -1
- package/dist/styled/components/index.d.ts +1 -0
- package/dist/styled/components/index.js +22 -20
- package/dist/styled/components/sidebar-chat.cjs +1 -1
- package/dist/styled/components/sidebar-chat.js +1 -1
- package/dist/styled/components/ui/recipes/ai-chat-page-wrapper.cjs +1 -1
- package/dist/styled/components/ui/recipes/ai-chat-page-wrapper.js +3 -2
- package/dist/styled/index.cjs +1 -1
- package/dist/styled/index.js +193 -185
- package/dist/styled/inkeep.css.cjs +146 -4
- package/dist/styled/inkeep.css.js +146 -4
- package/dist/types/config/ai.d.ts +17 -1
- package/dist/types/config/base.d.ts +21 -0
- package/dist/types/icons/built-in.d.ts +1 -1
- package/dist/types/icons/custom.d.ts +3 -0
- package/dist/types/js/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/primitives/index.js
CHANGED
|
@@ -1,168 +1,174 @@
|
|
|
1
|
-
import { AttachmentItemProvider as
|
|
2
|
-
import { AttachmentsBarProvider as x, useAttachmentsBar as
|
|
3
|
-
import { BaseEventsProvider as
|
|
4
|
-
import { ChatFormProvider as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
1
|
+
import { AttachmentItemProvider as u, useAttachmentItem as C } from "./providers/attachment-item-provider.js";
|
|
2
|
+
import { AttachmentsBarProvider as x, useAttachmentsBar as h } from "./providers/attachments-bar-provider.js";
|
|
3
|
+
import { BaseEventsProvider as v, useBaseEvents as P } from "./providers/base-events-provider.js";
|
|
4
|
+
import { ChatFormProvider as S, useChatForm as c, useChatFormState as b } from "./providers/chat-form-provider.js";
|
|
5
|
+
import { ChatHistoryProvider as B, useChatHistory as M } from "./providers/chat-history-provider.js";
|
|
6
|
+
import { InkeepConfigProvider as F, WebWidgetInteractionType as y, useInkeepConfig as A } from "./providers/config-provider.js";
|
|
7
|
+
import { FeedbackItemProvider as H, useFeedbackItem as R } from "./providers/feedback-item-provider.js";
|
|
8
|
+
import { FeedbackProvider as D, useMessageFeedback as O } from "./providers/feedback-provider.js";
|
|
9
|
+
import { FormFieldProvider as T, useFormField as z } from "./providers/form-field-provider.js";
|
|
10
|
+
import { HelpMenuProvider as $, useHelpMenu as j, useHelpMenuState as K } from "./providers/help-menu-provider.js";
|
|
11
|
+
import { ChatMarkdownProvider as Q, useChatMarkdown as U } from "./providers/markdown-provider.js";
|
|
12
|
+
import { MessageAttachmentsProvider as G, useMessageAttachments as J } from "./providers/message-attachments-provider.js";
|
|
13
|
+
import { MessageProvider as X, useMessage as Y, useOptionalMessage as Z } from "./providers/message-provider.js";
|
|
14
|
+
import { RootProvider as ee } from "./providers/root-provider.js";
|
|
15
|
+
import { SourceItemProvider as re, useSourceItem as te } from "./providers/source-item-provider.js";
|
|
16
|
+
import { ThemeProvider as me } from "./providers/theme-provider.js";
|
|
17
|
+
import { WidgetProvider as ie, useWidget as pe } from "./providers/widget-provider.js";
|
|
18
|
+
import { SidebarChatProvider as ne, useInkeepSidebarChat as ue, useOptionalSidebarChat as Ce, useSidebarChat as fe } from "./providers/sidebar-chat-provider.js";
|
|
19
|
+
import { ChatBubbleProvider as he, useChatBubble as le, useInkeepChatBubble as ve, useOptionalChatBubble as Pe } from "./providers/chat-bubble-provider.js";
|
|
20
|
+
import { ikp as Se, jsxFactory as ce } from "./components/factory.js";
|
|
20
21
|
import * as e from "./components/embedded-chat.js";
|
|
21
22
|
import * as o from "./components/sidebar-chat/index.js";
|
|
22
|
-
import { ChatProvider as
|
|
23
|
+
import { ChatProvider as ge, useChat as Be } from "./components/embedded-chat/chat-provider.js";
|
|
23
24
|
import * as r from "./components/embedded-search.js";
|
|
24
|
-
import { SearchProvider as
|
|
25
|
+
import { SearchProvider as ke, SearchProviderImpl as Fe, useSearch as ye } from "./components/embedded-search/search-provider.js";
|
|
25
26
|
import * as t from "./components/modal.js";
|
|
26
|
-
import { ModalProvider as
|
|
27
|
+
import { ModalProvider as we, useModal as He } from "./components/modal/modal-provider.js";
|
|
27
28
|
import * as a from "./components/chat-button.js";
|
|
28
29
|
import * as m from "./components/searchbar.js";
|
|
29
30
|
import * as s from "./components/chat-bubble/index.js";
|
|
30
|
-
import * as
|
|
31
|
-
import
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
31
|
+
import * as i from "./components/data-summaries.js";
|
|
32
|
+
import * as p from "./components/chat-history/index.js";
|
|
33
|
+
import { useBoolean as Ee } from "./hooks/use-boolean.js";
|
|
34
|
+
import { useComponentClassNames as Oe } from "./hooks/use-component-classnames.js";
|
|
35
|
+
import { useContainerSize as Te } from "./hooks/use-container-size.js";
|
|
36
|
+
import { useInkeepOpenState as Le } from "./hooks/use-inkeep-open-state.js";
|
|
37
|
+
import { useCopyToClipboard as je } from "./hooks/use-copy-to-clipboard.js";
|
|
38
|
+
import { useInstantUpdate as Ne } from "./hooks/use-instant-update.js";
|
|
39
|
+
import { useIsMounted as Ue } from "./hooks/use-is-mounted.js";
|
|
40
|
+
import { useMediaQuery as Ge } from "./hooks/use-media-query.js";
|
|
41
|
+
import { useResizeObserver as Ve } from "./hooks/use-resize-observer.js";
|
|
42
|
+
import { useScrollingFades as Ye } from "./hooks/use-scrolling-fades.js";
|
|
43
|
+
import { useSettleAction as _e } from "./hooks/use-settle-action.js";
|
|
44
|
+
import { useSimpleScroll as oo } from "./hooks/use-simple-scroll.js";
|
|
45
|
+
import { callAll as to, dataAttr as ao, getInitials as mo, getMessageContent as so, isString as io, maybeRender as po, toKebabCase as no } from "./utils/misc.js";
|
|
46
|
+
import { ChatBubbleComponentIds as Co, DataSummaryComponentIds as fo, SearchBarComponentIds as xo, SidebarChatComponentIds as ho, aiChatComponentIds as lo, aiChatHistoryComponentIds as vo, aiSearchComponentIds as Po, chatButtonComponentIds as Io, componentIDs as So, markDownComponentIds as co, miscellanousComponentIds as bo, modalComponentIds as go } from "./utils/component-ids.js";
|
|
47
|
+
import { composeRefs as Mo, useComposedRefs as ko } from "./utils/compose-refs.js";
|
|
48
|
+
import { mergeProps as yo } from "./utils/merge-props.js";
|
|
49
|
+
import { Portal as wo } from "./atoms/portal.js";
|
|
50
|
+
import { CustomIcon as Ro } from "./atoms/icons/custom-icon.js";
|
|
51
|
+
import { BuiltInIconRenderer as Do } from "./atoms/icons/built-in-icon-renderer.js";
|
|
52
|
+
import { PortalWithTheme as Wo } from "./atoms/portal-with-theme.js";
|
|
53
|
+
import { Command as zo, CommandDialog as Lo, CommandEmpty as $o, CommandInput as jo, CommandItem as Ko, CommandList as No, CommandLoading as Qo, CommandRoot as Uo, CommandSeparator as qo, defaultFilter as Go, useCommandState as Jo, useCommandStore as Vo } from "./atoms/cmdk/index.js";
|
|
54
|
+
import { ErrorBoundary as Yo } from "./atoms/error-boundary.js";
|
|
55
|
+
import { InkeepShadow as _o, InkeepShadowProvider as er, ShadowContext as or, useShadow as rr } from "./atoms/shadow/context.js";
|
|
54
56
|
export {
|
|
55
|
-
|
|
57
|
+
u as AttachmentItemProvider,
|
|
56
58
|
x as AttachmentsBarProvider,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
v as BaseEventsProvider,
|
|
60
|
+
Do as BuiltInIconRenderer,
|
|
61
|
+
Co as ChatBubbleComponentIds,
|
|
60
62
|
s as ChatBubblePrimitive,
|
|
61
|
-
|
|
63
|
+
he as ChatBubbleProvider,
|
|
62
64
|
a as ChatButtonPrimitive,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
65
|
+
S as ChatFormProvider,
|
|
66
|
+
p as ChatHistoryPrimitive,
|
|
67
|
+
B as ChatHistoryProvider,
|
|
68
|
+
Q as ChatMarkdownProvider,
|
|
69
|
+
ge as ChatProvider,
|
|
70
|
+
zo as Command,
|
|
71
|
+
Lo as CommandDialog,
|
|
72
|
+
$o as CommandEmpty,
|
|
73
|
+
jo as CommandInput,
|
|
74
|
+
Ko as CommandItem,
|
|
75
|
+
No as CommandList,
|
|
76
|
+
Qo as CommandLoading,
|
|
77
|
+
Uo as CommandRoot,
|
|
78
|
+
qo as CommandSeparator,
|
|
79
|
+
Ro as CustomIcon,
|
|
80
|
+
fo as DataSummaryComponentIds,
|
|
81
|
+
i as DataSummaryPrimitive,
|
|
78
82
|
e as EmbeddedChatPrimitive,
|
|
79
83
|
r as EmbeddedSearchPrimitive,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
Yo as ErrorBoundary,
|
|
85
|
+
H as FeedbackItemProvider,
|
|
86
|
+
D as FeedbackProvider,
|
|
87
|
+
T as FormFieldProvider,
|
|
88
|
+
$ as HelpMenuProvider,
|
|
89
|
+
F as InkeepConfigProvider,
|
|
90
|
+
_o as InkeepShadow,
|
|
91
|
+
er as InkeepShadowProvider,
|
|
92
|
+
G as MessageAttachmentsProvider,
|
|
93
|
+
X as MessageProvider,
|
|
90
94
|
t as ModalPrimitive,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
we as ModalProvider,
|
|
96
|
+
wo as Portal,
|
|
97
|
+
Wo as PortalWithTheme,
|
|
98
|
+
ee as RootProvider,
|
|
99
|
+
xo as SearchBarComponentIds,
|
|
96
100
|
m as SearchBarPrimitive,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
ke as SearchProvider,
|
|
102
|
+
Fe as SearchProviderImpl,
|
|
103
|
+
or as ShadowContext,
|
|
104
|
+
ho as SidebarChatComponentIds,
|
|
101
105
|
o as SidebarChatPrimitive,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
C as
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
z as
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
Le as
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
106
|
+
ne as SidebarChatProvider,
|
|
107
|
+
re as SourceItemProvider,
|
|
108
|
+
me as ThemeProvider,
|
|
109
|
+
y as WebWidgetInteractionType,
|
|
110
|
+
ie as WidgetProvider,
|
|
111
|
+
lo as aiChatComponentIds,
|
|
112
|
+
vo as aiChatHistoryComponentIds,
|
|
113
|
+
Po as aiSearchComponentIds,
|
|
114
|
+
to as callAll,
|
|
115
|
+
Io as chatButtonComponentIds,
|
|
116
|
+
So as componentIDs,
|
|
117
|
+
Mo as composeRefs,
|
|
118
|
+
ao as dataAttr,
|
|
119
|
+
Go as defaultFilter,
|
|
120
|
+
mo as getInitials,
|
|
121
|
+
so as getMessageContent,
|
|
122
|
+
Se as ikp,
|
|
123
|
+
io as isString,
|
|
124
|
+
ce as jsxFactory,
|
|
125
|
+
co as markDownComponentIds,
|
|
126
|
+
po as maybeRender,
|
|
127
|
+
yo as mergeProps,
|
|
128
|
+
bo as miscellanousComponentIds,
|
|
129
|
+
go as modalComponentIds,
|
|
130
|
+
no as toKebabCase,
|
|
131
|
+
C as useAttachmentItem,
|
|
132
|
+
h as useAttachmentsBar,
|
|
133
|
+
P as useBaseEvents,
|
|
134
|
+
Ee as useBoolean,
|
|
135
|
+
Be as useChat,
|
|
136
|
+
le as useChatBubble,
|
|
137
|
+
c as useChatForm,
|
|
138
|
+
b as useChatFormState,
|
|
139
|
+
M as useChatHistory,
|
|
140
|
+
U as useChatMarkdown,
|
|
141
|
+
Jo as useCommandState,
|
|
142
|
+
Vo as useCommandStore,
|
|
143
|
+
Oe as useComponentClassNames,
|
|
144
|
+
ko as useComposedRefs,
|
|
145
|
+
Te as useContainerSize,
|
|
146
|
+
je as useCopyToClipboard,
|
|
147
|
+
R as useFeedbackItem,
|
|
148
|
+
z as useFormField,
|
|
149
|
+
j as useHelpMenu,
|
|
150
|
+
K as useHelpMenuState,
|
|
151
|
+
ve as useInkeepChatBubble,
|
|
152
|
+
A as useInkeepConfig,
|
|
153
|
+
Le as useInkeepOpenState,
|
|
154
|
+
ue as useInkeepSidebarChat,
|
|
155
|
+
Ne as useInstantUpdate,
|
|
156
|
+
Ue as useIsMounted,
|
|
157
|
+
Ge as useMediaQuery,
|
|
158
|
+
Y as useMessage,
|
|
159
|
+
J as useMessageAttachments,
|
|
160
|
+
O as useMessageFeedback,
|
|
161
|
+
He as useModal,
|
|
162
|
+
Pe as useOptionalChatBubble,
|
|
163
|
+
Z as useOptionalMessage,
|
|
164
|
+
Ce as useOptionalSidebarChat,
|
|
165
|
+
Ve as useResizeObserver,
|
|
166
|
+
Ye as useScrollingFades,
|
|
167
|
+
ye as useSearch,
|
|
168
|
+
_e as useSettleAction,
|
|
169
|
+
rr as useShadow,
|
|
170
|
+
fe as useSidebarChat,
|
|
171
|
+
oo as useSimpleScroll,
|
|
172
|
+
te as useSourceItem,
|
|
173
|
+
pe as useWidget
|
|
168
174
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.15.
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.15.14",componentType:n,tags:o}),[n,o]),u={logEvent:t.useCallback(async c=>{const v={...i,...c.properties,...r},d={eventName:c.eventName,properties:v};return s.onEvent?.(d)},[s,i,r])};return E.jsx(a.Provider,{value:u,children:e})},g=()=>{const e=t.useContext(a);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=p;exports.useBaseEvents=g;
|
|
@@ -5,7 +5,7 @@ import { useInkeepConfig as g } from "./config-provider.js";
|
|
|
5
5
|
const a = d(void 0), P = ({ children: e }) => {
|
|
6
6
|
const { baseSettings: t, componentType: o } = g(), { tags: s, analyticsProperties: n } = t, r = u(
|
|
7
7
|
() => ({
|
|
8
|
-
widgetLibraryVersion: "0.15.
|
|
8
|
+
widgetLibraryVersion: "0.15.14",
|
|
9
9
|
componentType: o,
|
|
10
10
|
tags: s
|
|
11
11
|
}),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react/jsx-runtime"),e=require("react"),Y=require("../components/embedded-chat/chat-provider.cjs"),N=require("./config-provider.cjs"),ee=require("../hooks/use-inkeep-api-client.cjs"),F=e.createContext(void 0),D=25;function te(t){const{stop:a,clear:c,conversationId:u,isStreaming:H,loadAndRestoreSession:P,sessionToken:f,refreshSession:W,getCaptchaHeader:G,invalidateCaptcha:K}=Y.useChat(),{aiChatSettings:U}=N.useInkeepConfig(),{baseUrl:h,appId:k,apiKey:Z}=U,r=!Z&&!!k,C=f,{fetchWithAuth:I}=ee.useInkeepApiClient({appId:k,authToken:C,getCaptchaHeader:G,invalidateCaptcha:K,refreshSession:W}),[p,S]=e.useState(!1),[R,E]=e.useState([]),[g,x]=e.useState(!1),[m,_]=e.useState(0),[v,z]=e.useState(!1),b=e.useRef(!1),q=e.useRef(null),j=e.useRef([]);j.current=R;const M=e.useRef(I);M.current=I;const o=e.useCallback(async(s,i=!1)=>{if(!(!h||!C||!r)){x(!0);try{const w=`${h}/run/v1/conversations?page=${s+1}&limit=${D}`,y=await M.current(w);if(!y.ok)throw new Error(`Failed to fetch conversations: ${y.status}`);const L=await y.json(),d=(L.data??[]).map(n=>({id:n.id,title:n.title??"",createdAt:new Date(n.createdAt),updatedAt:new Date(n.updatedAt)}));E(n=>{if(s===0&&!i)return d;if(s===0&&i){const l=new Set(d.map(A=>A.id));return[...d,...n.slice(D).filter(A=>!l.has(A.id))]}const V=new Set(n.map(l=>l.id));return[...n,...d.filter(l=>!V.has(l.id))]});const{page:O,pages:T}=L.pagination??{};z(O!=null&&T!=null?O<T:!1),i||_(s)}catch(w){console.error("[useChatHistory] Failed to load conversations:",w)}finally{x(!1)}}},[h,C,r]);e.useEffect(()=>{!p||!f||!r||(t==="stack"?(E([]),o(0)):b.current||(b.current=!0,o(0)))},[p,f,r,t,o]);const $=e.useRef("");e.useEffect(()=>{r&&t==="sidepane"&&(!u||!H||b.current&&$.current!==u&&(j.current.some(s=>s.id===u)||($.current=u,o(0,!0))))},[u,r,t,o,H]);const B=e.useCallback(()=>{!g&&v&&o(m+1)},[g,v,m,o]),J=e.useCallback(()=>{a(),c(),t!=="sidepane"&&S(!1)},[t,a,c]),Q=e.useCallback(async s=>{q.current?.abort();const i=new AbortController;q.current=i,await P(s,i.signal),!i.signal.aborted&&t!=="sidepane"&&S(!1)},[t,P]);return{isEnabled:r,isOpen:p,setIsOpen:S,sessions:R,isLoading:g,hasMore:v,loadMore:B,startNewConversation:J,loadSession:Q}}const se=({layout:t,children:a})=>{const c=te(t);return X.jsx(F.Provider,{value:c,children:typeof a=="function"?a(c):a})},ne=()=>{const t=e.useContext(F);if(!t)throw new Error("useChatHistory must be used within a ChatHistoryProvider");return t};exports.ChatHistoryProvider=se;exports.useChatHistory=ne;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface ConversationApiItem {
|
|
2
|
+
id: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
updatedAt: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ChatSession {
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
}
|
|
13
|
+
export type ChatHistoryLayout = 'sidepane' | 'stack';
|
|
14
|
+
interface ChatHistoryContextValue {
|
|
15
|
+
/** False when chat history is unavailable (e.g. API key auth or no appId configured). */
|
|
16
|
+
isEnabled: boolean;
|
|
17
|
+
isOpen: boolean;
|
|
18
|
+
setIsOpen: (open: boolean) => void;
|
|
19
|
+
sessions: ChatSession[];
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
hasMore: boolean;
|
|
22
|
+
loadMore: () => void;
|
|
23
|
+
startNewConversation: () => void;
|
|
24
|
+
loadSession: (sessionId: string) => void;
|
|
25
|
+
}
|
|
26
|
+
export interface ChatHistoryProviderProps {
|
|
27
|
+
layout: ChatHistoryLayout;
|
|
28
|
+
children: React.ReactNode | ((value: ChatHistoryContextValue) => React.ReactNode);
|
|
29
|
+
}
|
|
30
|
+
export declare const ChatHistoryProvider: React.FC<ChatHistoryProviderProps>;
|
|
31
|
+
export declare const useChatHistory: () => ChatHistoryContextValue;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as tt } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as et, useContext as st, useState as u, useRef as d, useCallback as h, useEffect as G } from "react";
|
|
4
|
+
import { useChat as nt } from "../components/embedded-chat/chat-provider.js";
|
|
5
|
+
import { useInkeepConfig as rt } from "./config-provider.js";
|
|
6
|
+
import { useInkeepApiClient as ot } from "../hooks/use-inkeep-api-client.js";
|
|
7
|
+
const U = et(void 0), K = 25;
|
|
8
|
+
function it(t) {
|
|
9
|
+
const {
|
|
10
|
+
stop: i,
|
|
11
|
+
clear: a,
|
|
12
|
+
conversationId: c,
|
|
13
|
+
isStreaming: y,
|
|
14
|
+
loadAndRestoreSession: P,
|
|
15
|
+
sessionToken: p,
|
|
16
|
+
refreshSession: Z,
|
|
17
|
+
getCaptchaHeader: _,
|
|
18
|
+
invalidateCaptcha: q
|
|
19
|
+
} = nt(), { aiChatSettings: z } = rt(), { baseUrl: C, appId: k, apiKey: B } = z, n = !B && !!k, g = p, { fetchWithAuth: x } = ot({
|
|
20
|
+
appId: k,
|
|
21
|
+
authToken: g,
|
|
22
|
+
getCaptchaHeader: _,
|
|
23
|
+
invalidateCaptcha: q,
|
|
24
|
+
refreshSession: Z
|
|
25
|
+
}), [w, m] = u(!1), [E, R] = u([]), [S, $] = u(!1), [L, J] = u(0), [v, Q] = u(!1), A = d(!1), M = d(null), j = d([]);
|
|
26
|
+
j.current = E;
|
|
27
|
+
const D = d(x);
|
|
28
|
+
D.current = x;
|
|
29
|
+
const r = h(
|
|
30
|
+
async (e, o = !1) => {
|
|
31
|
+
if (!(!C || !g || !n)) {
|
|
32
|
+
$(!0);
|
|
33
|
+
try {
|
|
34
|
+
const b = `${C}/run/v1/conversations?page=${e + 1}&limit=${K}`, H = await D.current(b);
|
|
35
|
+
if (!H.ok) throw new Error(`Failed to fetch conversations: ${H.status}`);
|
|
36
|
+
const O = await H.json(), l = (O.data ?? []).map((s) => ({
|
|
37
|
+
id: s.id,
|
|
38
|
+
title: s.title ?? "",
|
|
39
|
+
createdAt: new Date(s.createdAt),
|
|
40
|
+
updatedAt: new Date(s.updatedAt)
|
|
41
|
+
}));
|
|
42
|
+
R((s) => {
|
|
43
|
+
if (e === 0 && !o) return l;
|
|
44
|
+
if (e === 0 && o) {
|
|
45
|
+
const f = new Set(l.map((I) => I.id));
|
|
46
|
+
return [...l, ...s.slice(K).filter((I) => !f.has(I.id))];
|
|
47
|
+
}
|
|
48
|
+
const N = new Set(s.map((f) => f.id));
|
|
49
|
+
return [...s, ...l.filter((f) => !N.has(f.id))];
|
|
50
|
+
});
|
|
51
|
+
const { page: T, pages: W } = O.pagination ?? {};
|
|
52
|
+
Q(T != null && W != null ? T < W : !1), o || J(e);
|
|
53
|
+
} catch (b) {
|
|
54
|
+
console.error("[useChatHistory] Failed to load conversations:", b);
|
|
55
|
+
} finally {
|
|
56
|
+
$(!1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
[C, g, n]
|
|
61
|
+
);
|
|
62
|
+
G(() => {
|
|
63
|
+
!w || !p || !n || (t === "stack" ? (R([]), r(0)) : A.current || (A.current = !0, r(0)));
|
|
64
|
+
}, [w, p, n, t, r]);
|
|
65
|
+
const F = d("");
|
|
66
|
+
G(() => {
|
|
67
|
+
n && t === "sidepane" && (!c || !y || A.current && F.current !== c && (j.current.some((e) => e.id === c) || (F.current = c, r(0, !0))));
|
|
68
|
+
}, [c, n, t, r, y]);
|
|
69
|
+
const V = h(() => {
|
|
70
|
+
!S && v && r(L + 1);
|
|
71
|
+
}, [S, v, L, r]), X = h(() => {
|
|
72
|
+
i(), a(), t !== "sidepane" && m(!1);
|
|
73
|
+
}, [t, i, a]), Y = h(
|
|
74
|
+
async (e) => {
|
|
75
|
+
M.current?.abort();
|
|
76
|
+
const o = new AbortController();
|
|
77
|
+
M.current = o, await P(e, o.signal), !o.signal.aborted && t !== "sidepane" && m(!1);
|
|
78
|
+
},
|
|
79
|
+
[t, P]
|
|
80
|
+
);
|
|
81
|
+
return {
|
|
82
|
+
isEnabled: n,
|
|
83
|
+
isOpen: w,
|
|
84
|
+
setIsOpen: m,
|
|
85
|
+
sessions: E,
|
|
86
|
+
isLoading: S,
|
|
87
|
+
hasMore: v,
|
|
88
|
+
loadMore: V,
|
|
89
|
+
startNewConversation: X,
|
|
90
|
+
loadSession: Y
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const ht = ({ layout: t, children: i }) => {
|
|
94
|
+
const a = it(t);
|
|
95
|
+
return /* @__PURE__ */ tt(U.Provider, { value: a, children: typeof i == "function" ? i(a) : i });
|
|
96
|
+
}, pt = () => {
|
|
97
|
+
const t = st(U);
|
|
98
|
+
if (!t)
|
|
99
|
+
throw new Error("useChatHistory must be used within a ChatHistoryProvider");
|
|
100
|
+
return t;
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
ht as ChatHistoryProvider,
|
|
104
|
+
pt as useChatHistory
|
|
105
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./attachment-item-provider.cjs"),d=require("./attachments-bar-provider.cjs"),u=require("./base-events-provider.cjs"),t=require("./chat-form-provider.cjs"),o=require("./config-provider.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./attachment-item-provider.cjs"),d=require("./attachments-bar-provider.cjs"),u=require("./base-events-provider.cjs"),t=require("./chat-form-provider.cjs"),n=require("./chat-history-provider.cjs"),o=require("./config-provider.cjs"),v=require("./feedback-item-provider.cjs"),P=require("./feedback-provider.cjs"),c=require("./form-field-provider.cjs"),s=require("./help-menu-provider.cjs"),h=require("./markdown-provider.cjs"),m=require("./message-attachments-provider.cjs"),i=require("./message-provider.cjs"),l=require("./root-provider.cjs"),b=require("./source-item-provider.cjs"),g=require("./theme-provider.cjs"),C=require("./widget-provider.cjs"),e=require("./sidebar-chat-provider.cjs"),r=require("./chat-bubble-provider.cjs");exports.AttachmentItemProvider=a.AttachmentItemProvider;exports.useAttachmentItem=a.useAttachmentItem;exports.AttachmentsBarProvider=d.AttachmentsBarProvider;exports.useAttachmentsBar=d.useAttachmentsBar;exports.BaseEventsProvider=u.BaseEventsProvider;exports.useBaseEvents=u.useBaseEvents;exports.ChatFormProvider=t.ChatFormProvider;exports.useChatForm=t.useChatForm;exports.useChatFormState=t.useChatFormState;exports.ChatHistoryProvider=n.ChatHistoryProvider;exports.useChatHistory=n.useChatHistory;exports.InkeepConfigProvider=o.InkeepConfigProvider;exports.WebWidgetInteractionType=o.WebWidgetInteractionType;exports.useInkeepConfig=o.useInkeepConfig;exports.FeedbackItemProvider=v.FeedbackItemProvider;exports.useFeedbackItem=v.useFeedbackItem;exports.FeedbackProvider=P.FeedbackProvider;exports.useMessageFeedback=P.useMessageFeedback;exports.FormFieldProvider=c.FormFieldProvider;exports.useFormField=c.useFormField;exports.HelpMenuProvider=s.HelpMenuProvider;exports.useHelpMenu=s.useHelpMenu;exports.useHelpMenuState=s.useHelpMenuState;exports.ChatMarkdownProvider=h.ChatMarkdownProvider;exports.useChatMarkdown=h.useChatMarkdown;exports.MessageAttachmentsProvider=m.MessageAttachmentsProvider;exports.useMessageAttachments=m.useMessageAttachments;exports.MessageProvider=i.MessageProvider;exports.useMessage=i.useMessage;exports.useOptionalMessage=i.useOptionalMessage;exports.RootProvider=l.RootProvider;exports.SourceItemProvider=b.SourceItemProvider;exports.useSourceItem=b.useSourceItem;exports.ThemeProvider=g.ThemeProvider;exports.WidgetProvider=C.WidgetProvider;exports.useWidget=C.useWidget;exports.SidebarChatProvider=e.SidebarChatProvider;exports.useInkeepSidebarChat=e.useInkeepSidebarChat;exports.useOptionalSidebarChat=e.useOptionalSidebarChat;exports.useSidebarChat=e.useSidebarChat;exports.ChatBubbleProvider=r.ChatBubbleProvider;exports.useChatBubble=r.useChatBubble;exports.useInkeepChatBubble=r.useInkeepChatBubble;exports.useOptionalChatBubble=r.useOptionalChatBubble;
|
|
@@ -2,6 +2,7 @@ export * from './attachment-item-provider';
|
|
|
2
2
|
export * from './attachments-bar-provider';
|
|
3
3
|
export * from './base-events-provider';
|
|
4
4
|
export * from './chat-form-provider';
|
|
5
|
+
export * from './chat-history-provider';
|
|
5
6
|
export * from './config-provider';
|
|
6
7
|
export * from './feedback-item-provider';
|
|
7
8
|
export * from './feedback-provider';
|