@inkeep/cxkit-primitives 0.5.42 → 0.5.44
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ae=require("openai"),t=require("react"),Re=require("../../providers/config-provider.cjs"),Le=require("../../providers/conversation-provider.cjs"),xe=require("../../providers/chat-events-provider.cjs"),D=require("../../utils/get-message-metadata.cjs"),Be=require("../../utils/misc.cjs"),ae=require("../../utils/reset-query-params.cjs"),De=require("../../providers/chat-form-provider.cjs"),Oe=require("../../providers/widget-provider.cjs"),Fe=require("../../hooks/use-media-query.cjs"),Te=require("./use-captcha.cjs"),Ke=require("../modal/modal-provider.cjs"),u=require("../../utils/generate-uid.cjs"),Qe=require("../../utils/tools/links-tool.cjs"),We=require("../../atoms/api/analytics/conversation.cjs"),Je=()=>{const{chatId:f,setConversation:re,conversation:N,resetConversation:ie}=Le.useInkeepConversation(),{baseSettings:b,aiChatSettings:O}=Re.useInkeepConfig(),{aiApiBaseUrl:F,shouldBypassCaptcha:T,filters:K}=b,Q=Ke.useModal(),{getSolution:ce,prefetchSolution:q,invalidateSolution:W}=Te.useCaptcha({fetchUrl:`${F}/v1/challenge`,shouldBypassCaptcha:T,shouldMakeInitialRequest:Q?Q.isOpen:!0}),le=new Ae({baseURL:`${F}/v1`,apiKey:b.apiKey,dangerouslyAllowBrowser:!0}),{onInputMessageChange:ue,getTools:ge,prompts:de,model:me,filters:J,onToolCall:fe}=O,[p,_]=t.useState(""),z=t.useRef(null);t.useEffect(()=>{ue?.(p)},[p]);const[g,l]=t.useState([]),[H,h]=t.useState(!1),[pe,v]=t.useState(!1),[he,j]=t.useState(null),[A,G]=t.useState(null),[y,S]=t.useState([]),ve=e=>{S(s=>[...s,e])},[ye,V]=t.useState({}),i=t.useRef([]),C=t.useRef(null),{logEvent:P}=xe.useChatEvents(),X=de?.map((e,s)=>({id:`system-${Date.now().toString()}-${u.generateUid(4)}-${s}`,role:"system",content:e})),[Se,Ce]=t.useState(!!f);t.useEffect(()=>{if(f){const{apiKey:e,analyticsApiBaseUrl:s}=b;We.getConversation(f,e,s).then(n=>{if(n){P({eventName:"shared_chat_loaded",properties:{conversation:n}}),Ce(!1),re({...n,id:""});const a=n.messages.map(c=>({id:Date.now().toString()+u.generateUid(4)+c.id,content:Be.parseIfJson(c.content),role:c.role,links:c.links}));l(a),i.current=a}})}},[f]);const Me=e=>{switch(e.code){case 400:return e.message;case 403:return`There seems to be a configuration error. Please contact ${b.organizationDisplayName??"Administrator"}`;default:return`Hmm..
|
|
2
2
|
|
|
3
|
-
It seems I might be having some issues right now. Please clear the chat and try again.`}},Y=e=>{j(e),l(s=>{const n=[...s],a=n[n.length-1];return a&&(a.content=
|
|
4
|
-
${
|
|
3
|
+
It seems I might be having some issues right now. Please clear the chat and try again.`}},Y=e=>{j(e),l(s=>{const n=[...s],a=n[n.length-1];return a&&(a.content=Me(e)),n}),h(!1),v(!1),W(),q()},R=!p.trim()&&!y.length||H,we=e=>{e.key==="Enter"&&!e.shiftKey&&!R&&!e.nativeEvent.isComposing&&(e.preventDefault(),L())},Ie=e=>{const s=e.target.value;_(s)},L=async(e=p)=>{if(R&&(!e||e.trim().length===0))return;h(!0);const s=A?g.length===2:g.length===0,n=D.getMessageMetadata(A,y,s);let a;const c=D.serializeAttachments(y);y.length&&c?a=[{type:"text",text:c}]:a=e;const ee={id:`${Date.now().toString()}-${u.generateUid(4)}-1`,role:"user",content:a,metadata:n},E=[...g.length?[]:X,ee];f&&ae.resetQueryParams(),l(M=>[...M,...E]),i.current=[...i.current,...E],S([]),_(""),P({eventName:"user_message_submitted",properties:{}},i.current);const te=[Qe.provideLinksTool,...ge?.({conversation:N})||[]];try{const M={model:me,messages:i.current,stream:!0,tools:te,tool_choice:"auto"},se=await ce(),ne=se?btoa(JSON.stringify(se)):null,oe=K||J?JSON.stringify({...K,...J}):void 0,U={};!T&&ne&&(U["X-INKEEP-CHALLENGE-SOLUTION"]=ne),oe&&(U["inkeep-filters"]=oe);const d=le.beta.chat.completions.stream(M,Object.keys(U).length>0?{headers:U}:void 0),o={id:`${Date.now().toString()}-${u.generateUid(4)}-2`,role:"assistant",content:"",links:[],toolCalls:[]};l(w=>[...w,o]),d.on("content",(w,I)=>{v(!0),o.content=I,l($=>{const r=[...$],x=r.findIndex(k=>k.id===o.id);return x===-1?[...r,o]:(r[x]={...o},r)})}),d.on("tool_calls.function.arguments.done",w=>{const{name:I,arguments:$}=w,r=te?.find(m=>m.function.name===I);if(!r)return;fe?.(w,{conversation:N});const k=("parse"in r.function?r.function.parse:JSON.parse)($),Ue=r.function.function?.(k,d),$e=r.renderMessageButtons?.({args:k,execution:Ue})??[];I==="provideLinks"?o.links=k.links??[]:V(m=>({...m,[o.id]:[...m[o.id]??[],...$e]})),o.toolCalls?.push({id:"call_"+u.generateUid(24),type:"function",function:{name:I,arguments:$}}),l(m=>{const B=[...m],Ne=B.findIndex(_e=>_e.id===o.id);return B[Ne]={...o},B})}),d.on("error",Y),d.finalChatCompletion().then(()=>{i.current=[...i.current,o],C.current=null,h(!1),v(!1),q(),P({eventName:"assistant_message_received",properties:{}},i.current)}),C.current=d.controller}catch(M){Y(M),h(!1),v(!1)}},ke=()=>{C.current&&(C.current.abort(),C.current=null),h(!1),v(!1),q()},Z=()=>{j(null),l([]),i.current=[],ie(),V({}),S([]),ae.resetQueryParams(),G(null),W(),q(),P({eventName:"chat_clear_button_clicked",properties:{conversation:N}})},be=e=>{G(e);const{initialReplyMessage:s,displayName:n}=e,a={id:g.length.toString()+u.generateUid(4),role:"user",content:n},c={id:(g.length+1).toString()+u.generateUid(4),role:"assistant",content:s,links:[]},E=[{id:`system-${Date.now().toString()}-${u.generateUid(4)}-${e.id}`,role:"system",content:`Company has asked user to follow this guided workflow:
|
|
4
|
+
${D.serializeWorkflow(e)}`},...X,a,c];l(E),S([])},{openForm:qe}=De.useChatForm(),Pe=Oe.useWidget();t.useImperativeHandle(O.chatFunctionsRef,()=>({submitMessage:L,updateInputMessage(e){_(e)},clearChat:Z,openForm:e=>{Pe?.setView("chat"),qe(e)},focusInput:()=>{z.current?.focus()}}));const Ee=Fe.useMediaQuery("(max-width: 768px)");return{messages:g,input:p,isLoading:H,isStreaming:pe,isLoadingConversation:Se,error:he,isSubmitDisabled:R,handleInputChange:Ie,handleInputKeyDown:we,handleSubmit:L,stop:ke,clear:Z,handleWorkflow:be,selectedWorkflow:A,messageAttachments:y,setMessageAttachments:S,addAttachment:ve,messageButtons:ye,isEmpty:g.length===0,inputRef:z,isMobile:Ee}};exports.useInkeepChat=Je;
|
|
@@ -1,51 +1,58 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import { useState as c, useRef as
|
|
4
|
-
import { useInkeepConfig as
|
|
5
|
-
import { useInkeepConversation as
|
|
6
|
-
import { useChatEvents as
|
|
7
|
-
import { getMessageMetadata as
|
|
2
|
+
import De from "openai";
|
|
3
|
+
import { useState as c, useRef as U, useEffect as ae, useImperativeHandle as Oe } from "react";
|
|
4
|
+
import { useInkeepConfig as Re } from "../../providers/config-provider.js";
|
|
5
|
+
import { useInkeepConversation as Pe } from "../../providers/conversation-provider.js";
|
|
6
|
+
import { useChatEvents as Ue } from "../../providers/chat-events-provider.js";
|
|
7
|
+
import { getMessageMetadata as Fe, serializeAttachments as Ke, serializeWorkflow as Te } from "../../utils/get-message-metadata.js";
|
|
8
8
|
import { parseIfJson as We } from "../../utils/misc.js";
|
|
9
9
|
import { resetQueryParams as re } from "../../utils/reset-query-params.js";
|
|
10
10
|
import { useChatForm as Je } from "../../providers/chat-form-provider.js";
|
|
11
|
-
import { useWidget as
|
|
12
|
-
import { useMediaQuery as
|
|
13
|
-
import { useCaptcha as
|
|
14
|
-
import { useModal as
|
|
11
|
+
import { useWidget as ze } from "../../providers/widget-provider.js";
|
|
12
|
+
import { useMediaQuery as He } from "../../hooks/use-media-query.js";
|
|
13
|
+
import { useCaptcha as Qe } from "./use-captcha.js";
|
|
14
|
+
import { useModal as je } from "../modal/modal-provider.js";
|
|
15
15
|
import { generateUid as u } from "../../utils/generate-uid.js";
|
|
16
|
-
import { provideLinksTool as
|
|
17
|
-
import { getConversation as
|
|
18
|
-
const
|
|
19
|
-
const { chatId: d, setConversation: ie, conversation:
|
|
16
|
+
import { provideLinksTool as qe } from "../../utils/tools/links-tool.js";
|
|
17
|
+
import { getConversation as Ge } from "../../atoms/api/analytics/conversation.js";
|
|
18
|
+
const gt = () => {
|
|
19
|
+
const { chatId: d, setConversation: ie, conversation: x, resetConversation: ce } = Pe(), { baseSettings: b, aiChatSettings: F } = Re(), { aiApiBaseUrl: K, shouldBypassCaptcha: T, filters: W } = b, J = je(), { getSolution: le, prefetchSolution: $, invalidateSolution: z } = Qe({
|
|
20
20
|
fetchUrl: `${K}/v1/challenge`,
|
|
21
|
-
shouldBypassCaptcha:
|
|
22
|
-
shouldMakeInitialRequest:
|
|
23
|
-
}), ue = new
|
|
21
|
+
shouldBypassCaptcha: T,
|
|
22
|
+
shouldMakeInitialRequest: J ? J.isOpen : !0
|
|
23
|
+
}), ue = new De({
|
|
24
24
|
baseURL: `${K}/v1`,
|
|
25
|
-
apiKey:
|
|
25
|
+
apiKey: b.apiKey,
|
|
26
26
|
dangerouslyAllowBrowser: !0
|
|
27
|
-
}), {
|
|
27
|
+
}), {
|
|
28
|
+
onInputMessageChange: me,
|
|
29
|
+
getTools: ge,
|
|
30
|
+
prompts: pe,
|
|
31
|
+
model: de,
|
|
32
|
+
filters: H,
|
|
33
|
+
onToolCall: fe
|
|
34
|
+
} = F, [f, L] = c(""), Q = U(null);
|
|
28
35
|
ae(() => {
|
|
29
36
|
me?.(f);
|
|
30
37
|
}, [f]);
|
|
31
|
-
const [m, l] = c([]), [j, h] = c(!1), [
|
|
38
|
+
const [m, l] = c([]), [j, h] = c(!1), [he, y] = c(!1), [ye, q] = c(null), [B, G] = c(null), [C, w] = c([]), Ce = (e) => {
|
|
32
39
|
w((t) => [...t, e]);
|
|
33
|
-
}, [
|
|
40
|
+
}, [we, V] = c({}), r = U([]), v = U(null), { logEvent: E } = Ue(), X = pe?.map((e, t) => ({
|
|
34
41
|
id: `system-${Date.now().toString()}-${u(4)}-${t}`,
|
|
35
42
|
role: "system",
|
|
36
43
|
content: e
|
|
37
|
-
})), [
|
|
44
|
+
})), [ve, Ie] = c(!!d);
|
|
38
45
|
ae(() => {
|
|
39
46
|
if (d) {
|
|
40
|
-
const { apiKey: e, analyticsApiBaseUrl: t } =
|
|
41
|
-
|
|
47
|
+
const { apiKey: e, analyticsApiBaseUrl: t } = b;
|
|
48
|
+
Ge(d, e, t).then((s) => {
|
|
42
49
|
if (s) {
|
|
43
|
-
|
|
50
|
+
E({
|
|
44
51
|
eventName: "shared_chat_loaded",
|
|
45
52
|
properties: {
|
|
46
53
|
conversation: s
|
|
47
54
|
}
|
|
48
|
-
}),
|
|
55
|
+
}), Ie(!1), ie({ ...s, id: "" });
|
|
49
56
|
const o = s.messages.map((i) => ({
|
|
50
57
|
id: Date.now().toString() + u(4) + i.id,
|
|
51
58
|
content: We(i.content),
|
|
@@ -57,12 +64,12 @@ const mt = () => {
|
|
|
57
64
|
});
|
|
58
65
|
}
|
|
59
66
|
}, [d]);
|
|
60
|
-
const
|
|
67
|
+
const Me = (e) => {
|
|
61
68
|
switch (e.code) {
|
|
62
69
|
case 400:
|
|
63
70
|
return e.message;
|
|
64
71
|
case 403:
|
|
65
|
-
return `There seems to be a configuration error. Please contact ${
|
|
72
|
+
return `There seems to be a configuration error. Please contact ${b.organizationDisplayName ?? "Administrator"}`;
|
|
66
73
|
default:
|
|
67
74
|
return `Hmm..
|
|
68
75
|
|
|
@@ -71,34 +78,34 @@ It seems I might be having some issues right now. Please clear the chat and try
|
|
|
71
78
|
}, Y = (e) => {
|
|
72
79
|
q(e), l((t) => {
|
|
73
80
|
const s = [...t], o = s[s.length - 1];
|
|
74
|
-
return o && (o.content =
|
|
75
|
-
}), h(!1), y(!1), z(),
|
|
76
|
-
},
|
|
77
|
-
e.key === "Enter" && !e.shiftKey && !
|
|
78
|
-
},
|
|
81
|
+
return o && (o.content = Me(e)), s;
|
|
82
|
+
}), h(!1), y(!1), z(), $();
|
|
83
|
+
}, D = !f.trim() && !C.length || j, Se = (e) => {
|
|
84
|
+
e.key === "Enter" && !e.shiftKey && !D && !e.nativeEvent.isComposing && (e.preventDefault(), O());
|
|
85
|
+
}, ke = (e) => {
|
|
79
86
|
const t = e.target.value;
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
if (
|
|
87
|
+
L(t);
|
|
88
|
+
}, O = async (e = f) => {
|
|
89
|
+
if (D && (!e || e.trim().length === 0)) return;
|
|
83
90
|
h(!0);
|
|
84
|
-
const t =
|
|
91
|
+
const t = B ? m.length === 2 : m.length === 0, s = Fe(B, C, t);
|
|
85
92
|
let o;
|
|
86
|
-
const i =
|
|
93
|
+
const i = Ke(C);
|
|
87
94
|
C.length && i ? o = [{ type: "text", text: i }] : o = e;
|
|
88
95
|
const ee = {
|
|
89
96
|
id: `${Date.now().toString()}-${u(4)}-1`,
|
|
90
97
|
role: "user",
|
|
91
98
|
content: o,
|
|
92
99
|
metadata: s
|
|
93
|
-
},
|
|
94
|
-
d && re(), l((I) => [...I, ...
|
|
100
|
+
}, N = [...m.length ? [] : X, ee];
|
|
101
|
+
d && re(), l((I) => [...I, ...N]), r.current = [...r.current, ...N], w([]), L(""), E(
|
|
95
102
|
{
|
|
96
103
|
eventName: "user_message_submitted",
|
|
97
104
|
properties: {}
|
|
98
105
|
},
|
|
99
106
|
r.current
|
|
100
107
|
);
|
|
101
|
-
const te = [
|
|
108
|
+
const te = [qe, ...ge?.({ conversation: x }) || []];
|
|
102
109
|
try {
|
|
103
110
|
const I = {
|
|
104
111
|
model: de,
|
|
@@ -106,14 +113,14 @@ It seems I might be having some issues right now. Please clear the chat and try
|
|
|
106
113
|
stream: !0,
|
|
107
114
|
tools: te,
|
|
108
115
|
tool_choice: "auto"
|
|
109
|
-
}, se = await le(), ne = se ? btoa(JSON.stringify(se)) : null, oe =
|
|
110
|
-
...
|
|
116
|
+
}, se = await le(), ne = se ? btoa(JSON.stringify(se)) : null, oe = W || H ? JSON.stringify({
|
|
117
|
+
...W,
|
|
111
118
|
...H
|
|
112
|
-
}) : void 0,
|
|
113
|
-
!
|
|
119
|
+
}) : void 0, _ = {};
|
|
120
|
+
!T && ne && (_["X-INKEEP-CHALLENGE-SOLUTION"] = ne), oe && (_["inkeep-filters"] = oe);
|
|
114
121
|
const g = ue.beta.chat.completions.stream(
|
|
115
122
|
I,
|
|
116
|
-
Object.keys(
|
|
123
|
+
Object.keys(_).length > 0 ? { headers: _ } : void 0
|
|
117
124
|
), n = {
|
|
118
125
|
id: `${Date.now().toString()}-${u(4)}-2`,
|
|
119
126
|
role: "assistant",
|
|
@@ -121,31 +128,32 @@ It seems I might be having some issues right now. Please clear the chat and try
|
|
|
121
128
|
links: [],
|
|
122
129
|
toolCalls: []
|
|
123
130
|
};
|
|
124
|
-
l((
|
|
125
|
-
y(!0), n.content =
|
|
126
|
-
const a = [...A],
|
|
127
|
-
return
|
|
131
|
+
l((M) => [...M, n]), g.on("content", (M, S) => {
|
|
132
|
+
y(!0), n.content = S, l((A) => {
|
|
133
|
+
const a = [...A], R = a.findIndex((k) => k.id === n.id);
|
|
134
|
+
return R === -1 ? [...a, n] : (a[R] = { ...n }, a);
|
|
128
135
|
});
|
|
129
|
-
}), g.on("tool_calls.function.arguments.done", (
|
|
130
|
-
const { name:
|
|
136
|
+
}), g.on("tool_calls.function.arguments.done", (M) => {
|
|
137
|
+
const { name: S, arguments: A } = M, a = te?.find((p) => p.function.name === S);
|
|
131
138
|
if (!a) return;
|
|
132
|
-
|
|
133
|
-
|
|
139
|
+
fe?.(M, { conversation: x });
|
|
140
|
+
const k = ("parse" in a.function ? a.function.parse : JSON.parse)(A), Ae = a.function.function?.(k, g), xe = a.renderMessageButtons?.({ args: k, execution: Ae }) ?? [];
|
|
141
|
+
S === "provideLinks" ? n.links = k.links ?? [] : V((p) => ({
|
|
134
142
|
...p,
|
|
135
|
-
[n.id]: [...p[n.id] ?? [], ...
|
|
143
|
+
[n.id]: [...p[n.id] ?? [], ...xe]
|
|
136
144
|
})), n.toolCalls?.push({
|
|
137
145
|
id: "call_" + u(24),
|
|
138
146
|
type: "function",
|
|
139
147
|
function: {
|
|
140
|
-
name:
|
|
148
|
+
name: S,
|
|
141
149
|
arguments: A
|
|
142
150
|
}
|
|
143
151
|
}), l((p) => {
|
|
144
|
-
const
|
|
145
|
-
return
|
|
152
|
+
const P = [...p], Le = P.findIndex((Be) => Be.id === n.id);
|
|
153
|
+
return P[Le] = { ...n }, P;
|
|
146
154
|
});
|
|
147
155
|
}), g.on("error", Y), g.finalChatCompletion().then(() => {
|
|
148
|
-
r.current = [...r.current, n], v.current = null, h(!1), y(!1),
|
|
156
|
+
r.current = [...r.current, n], v.current = null, h(!1), y(!1), $(), E(
|
|
149
157
|
{
|
|
150
158
|
eventName: "assistant_message_received",
|
|
151
159
|
properties: {}
|
|
@@ -156,16 +164,16 @@ It seems I might be having some issues right now. Please clear the chat and try
|
|
|
156
164
|
} catch (I) {
|
|
157
165
|
Y(I), h(!1), y(!1);
|
|
158
166
|
}
|
|
159
|
-
},
|
|
160
|
-
v.current && (v.current.abort(), v.current = null), h(!1), y(!1),
|
|
167
|
+
}, be = () => {
|
|
168
|
+
v.current && (v.current.abort(), v.current = null), h(!1), y(!1), $();
|
|
161
169
|
}, Z = () => {
|
|
162
|
-
q(null), l([]), r.current = [], ce(), V({}), w([]), re(), G(null), z(),
|
|
170
|
+
q(null), l([]), r.current = [], ce(), V({}), w([]), re(), G(null), z(), $(), E({
|
|
163
171
|
eventName: "chat_clear_button_clicked",
|
|
164
172
|
properties: {
|
|
165
|
-
conversation:
|
|
173
|
+
conversation: x
|
|
166
174
|
}
|
|
167
175
|
});
|
|
168
|
-
},
|
|
176
|
+
}, $e = (e) => {
|
|
169
177
|
G(e);
|
|
170
178
|
const { initialReplyMessage: t, displayName: s } = e, o = {
|
|
171
179
|
id: m.length.toString() + u(4),
|
|
@@ -176,52 +184,52 @@ It seems I might be having some issues right now. Please clear the chat and try
|
|
|
176
184
|
role: "assistant",
|
|
177
185
|
content: t,
|
|
178
186
|
links: []
|
|
179
|
-
},
|
|
187
|
+
}, N = [{
|
|
180
188
|
id: `system-${Date.now().toString()}-${u(4)}-${e.id}`,
|
|
181
189
|
role: "system",
|
|
182
190
|
content: `Company has asked user to follow this guided workflow:
|
|
183
|
-
${
|
|
191
|
+
${Te(e)}`
|
|
184
192
|
}, ...X, o, i];
|
|
185
|
-
l(
|
|
186
|
-
}, { openForm:
|
|
187
|
-
|
|
188
|
-
submitMessage:
|
|
193
|
+
l(N), w([]);
|
|
194
|
+
}, { openForm: Ee } = Je(), Ne = ze();
|
|
195
|
+
Oe(F.chatFunctionsRef, () => ({
|
|
196
|
+
submitMessage: O,
|
|
189
197
|
updateInputMessage(e) {
|
|
190
|
-
|
|
198
|
+
L(e);
|
|
191
199
|
},
|
|
192
200
|
clearChat: Z,
|
|
193
201
|
openForm: (e) => {
|
|
194
|
-
|
|
202
|
+
Ne?.setView("chat"), Ee(e);
|
|
195
203
|
},
|
|
196
204
|
focusInput: () => {
|
|
197
205
|
Q.current?.focus();
|
|
198
206
|
}
|
|
199
207
|
}));
|
|
200
|
-
const
|
|
208
|
+
const _e = He("(max-width: 768px)");
|
|
201
209
|
return {
|
|
202
210
|
messages: m,
|
|
203
211
|
input: f,
|
|
204
212
|
isLoading: j,
|
|
205
|
-
isStreaming:
|
|
206
|
-
isLoadingConversation:
|
|
207
|
-
error:
|
|
208
|
-
isSubmitDisabled:
|
|
209
|
-
handleInputChange:
|
|
210
|
-
handleInputKeyDown:
|
|
211
|
-
handleSubmit:
|
|
212
|
-
stop:
|
|
213
|
+
isStreaming: he,
|
|
214
|
+
isLoadingConversation: ve,
|
|
215
|
+
error: ye,
|
|
216
|
+
isSubmitDisabled: D,
|
|
217
|
+
handleInputChange: ke,
|
|
218
|
+
handleInputKeyDown: Se,
|
|
219
|
+
handleSubmit: O,
|
|
220
|
+
stop: be,
|
|
213
221
|
clear: Z,
|
|
214
|
-
handleWorkflow:
|
|
215
|
-
selectedWorkflow:
|
|
222
|
+
handleWorkflow: $e,
|
|
223
|
+
selectedWorkflow: B,
|
|
216
224
|
messageAttachments: C,
|
|
217
225
|
setMessageAttachments: w,
|
|
218
|
-
addAttachment:
|
|
219
|
-
messageButtons:
|
|
226
|
+
addAttachment: Ce,
|
|
227
|
+
messageButtons: we,
|
|
220
228
|
isEmpty: m.length === 0,
|
|
221
229
|
inputRef: Q,
|
|
222
|
-
isMobile:
|
|
230
|
+
isMobile: _e
|
|
223
231
|
};
|
|
224
232
|
};
|
|
225
233
|
export {
|
|
226
|
-
|
|
234
|
+
gt as useInkeepChat
|
|
227
235
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),b=require("./user-provider.cjs"),p=t.createContext(void 0),f=({children:e})=>{const{baseSettings:s,componentType:n}=B.useInkeepConfig(),{apiKey:o,analyticsApiBaseUrl:r,tags:i,privacyPreferences:d,env:E}=s,{userProperties:c}=b.useUser(),a=t.useMemo(()=>({widgetLibraryVersion:"0.5.
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),b=require("./user-provider.cjs"),p=t.createContext(void 0),f=({children:e})=>{const{baseSettings:s,componentType:n}=B.useInkeepConfig(),{apiKey:o,analyticsApiBaseUrl:r,tags:i,privacyPreferences:d,env:E}=s,{userProperties:c}=b.useUser(),a=t.useMemo(()=>({widgetLibraryVersion:"0.5.44",componentType:n,tags:i}),[n,i]),u=!d.optOutAllAnalytics&&E!=="development",g={logEvent:t.useCallback(async v=>{const m={...a,...v.properties},l={eventName:v.eventName,properties:m,userProperties:c};u&&y.logEvent(l,o,r),s.onEvent?.(l)},[u,s,o,r,c,a])};return P.jsx(p.Provider,{value:g,children:e})},x=()=>{const e=t.useContext(p);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=f;exports.useBaseEvents=x;
|
|
@@ -7,7 +7,7 @@ import { useUser as b } from "./user-provider.js";
|
|
|
7
7
|
const m = x(void 0), U = ({ children: e }) => {
|
|
8
8
|
const { baseSettings: t, componentType: o } = C(), { apiKey: n, analyticsApiBaseUrl: s, tags: r, privacyPreferences: u, env: l } = t, { userProperties: i } = b(), a = d(
|
|
9
9
|
() => ({
|
|
10
|
-
widgetLibraryVersion: "0.5.
|
|
10
|
+
widgetLibraryVersion: "0.5.44",
|
|
11
11
|
componentType: o,
|
|
12
12
|
tags: r
|
|
13
13
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/cxkit-primitives",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.44",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Inkeep, Inc. Customer License (IICL) v1.1",
|
|
6
6
|
"homepage": "",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"remark-gfm": "^4.0.1",
|
|
60
60
|
"unist-util-visit": "^5.0.0",
|
|
61
61
|
"use-sync-external-store": "^1.4.0",
|
|
62
|
-
"@inkeep/cxkit-color-mode": "0.5.
|
|
63
|
-
"@inkeep/cxkit-theme": "0.5.
|
|
64
|
-
"@inkeep/cxkit-types": "0.5.
|
|
62
|
+
"@inkeep/cxkit-color-mode": "0.5.44",
|
|
63
|
+
"@inkeep/cxkit-theme": "0.5.44",
|
|
64
|
+
"@inkeep/cxkit-types": "0.5.44"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@biomejs/biome": "1.9.4",
|