@inkeep/agents-ui 0.0.0-dev-20260509025038 → 0.0.0-dev-20260511170227
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 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),g=require("react"),j=require("./config-provider.cjs"),B=require("./chat-auth-provider.cjs"),O=require("../hooks/use-events-api.cjs"),U=require("./base-events-provider.cjs"),x=({children:h})=>{const{baseSettings:n,aiChatSettings:y,componentType:c}=j.useInkeepConfig(),{tags:t,analyticsProperties:r,privacyPreferences:b,userProperties:o}=n,p="0.16.1",a=g.useMemo(()=>({widgetLibraryVersion:p,componentType:c}),[c,p]),{effectiveAuthToken:i,applicableRefreshSession:f,getCaptchaHeader:E,invalidateCaptcha:P}=B.useChatAuth(),{baseUrl:m,appId:A,analyticsApiBaseUrl:C}=y,l=b?.optOutAllAnalytics??!1,{logEvent:v}=O.useEventsApi({baseUrl:C??m,appId:A,authToken:i,getCaptchaHeader:E,invalidateCaptcha:P,refreshSession:f}),I={logEvent:g.useCallback(async s=>{const k={eventName:s.eventName,properties:{...a,...t?{tags:t}:{},...s.properties,...r}};if(!l&&i){const e=s.properties??{},u=typeof e.conversationId=="string"?e.conversationId:void 0,d=typeof e.messageId=="string"?e.messageId:void 0,q=!!o&&Object.keys(o).length>0,S={...t?{tags:t}:{},...r??{}},w={...a,...s.properties};v({body:{type:s.eventName,...u?{conversationId:u}:{},...d?{messageId:d}:{},...q?{userProperties:o}:{},properties:S,metadata:w}})}try{return await n.onEvent?.(k)}catch(e){console.warn("[events] onEvent callback threw",e)}},[n,a,t,r,v,l,i,o])};return T.jsx(U.BaseEventsContext.Provider,{value:I,children:h})};exports.ChatBaseEventsProvider=x;
|
|
@@ -1,65 +1,73 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { useInkeepConfig as
|
|
5
|
-
import { useChatAuth as
|
|
6
|
-
import { useEventsApi as
|
|
7
|
-
import { BaseEventsContext as
|
|
8
|
-
const
|
|
9
|
-
const { baseSettings:
|
|
2
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as U, useCallback as x } from "react";
|
|
4
|
+
import { useInkeepConfig as B } from "./config-provider.js";
|
|
5
|
+
import { useChatAuth as N } from "./chat-auth-provider.js";
|
|
6
|
+
import { useEventsApi as O } from "../hooks/use-events-api.js";
|
|
7
|
+
import { BaseEventsContext as j } from "./base-events-provider.js";
|
|
8
|
+
const D = ({ children: g }) => {
|
|
9
|
+
const { baseSettings: n, aiChatSettings: f, componentType: c } = B(), { tags: t, analyticsProperties: r, privacyPreferences: u, userProperties: o } = n, p = "0.16.1", a = U(
|
|
10
10
|
() => ({
|
|
11
|
-
widgetLibraryVersion:
|
|
12
|
-
componentType:
|
|
13
|
-
tags: a
|
|
11
|
+
widgetLibraryVersion: p,
|
|
12
|
+
componentType: c
|
|
14
13
|
}),
|
|
15
|
-
[
|
|
16
|
-
), { effectiveAuthToken:
|
|
17
|
-
baseUrl:
|
|
18
|
-
appId:
|
|
19
|
-
authToken:
|
|
20
|
-
getCaptchaHeader:
|
|
21
|
-
invalidateCaptcha:
|
|
22
|
-
refreshSession:
|
|
23
|
-
}),
|
|
24
|
-
async (
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
[c, p]
|
|
15
|
+
), { effectiveAuthToken: i, applicableRefreshSession: h, getCaptchaHeader: y, invalidateCaptcha: b } = N(), { baseUrl: A, appId: E, analyticsApiBaseUrl: C } = f, l = u?.optOutAllAnalytics ?? !1, { logEvent: v } = O({
|
|
16
|
+
baseUrl: C ?? A,
|
|
17
|
+
appId: E,
|
|
18
|
+
authToken: i,
|
|
19
|
+
getCaptchaHeader: y,
|
|
20
|
+
invalidateCaptcha: b,
|
|
21
|
+
refreshSession: h
|
|
22
|
+
}), I = { logEvent: x(
|
|
23
|
+
async (s) => {
|
|
24
|
+
const P = {
|
|
25
|
+
eventName: s.eventName,
|
|
26
|
+
properties: {
|
|
27
|
+
...a,
|
|
28
|
+
...t ? { tags: t } : {},
|
|
29
|
+
...s.properties,
|
|
30
|
+
...r
|
|
31
|
+
}
|
|
32
32
|
};
|
|
33
|
-
if (!l &&
|
|
34
|
-
const e =
|
|
33
|
+
if (!l && i) {
|
|
34
|
+
const e = s.properties ?? {}, m = typeof e.conversationId == "string" ? e.conversationId : void 0, d = typeof e.messageId == "string" ? e.messageId : void 0, k = !!o && Object.keys(o).length > 0, w = {
|
|
35
|
+
...t ? { tags: t } : {},
|
|
36
|
+
...r ?? {}
|
|
37
|
+
}, S = {
|
|
38
|
+
...a,
|
|
39
|
+
...s.properties
|
|
40
|
+
};
|
|
35
41
|
v({
|
|
36
42
|
body: {
|
|
37
|
-
type:
|
|
38
|
-
...
|
|
39
|
-
...
|
|
40
|
-
...
|
|
41
|
-
properties:
|
|
43
|
+
type: s.eventName,
|
|
44
|
+
...m ? { conversationId: m } : {},
|
|
45
|
+
...d ? { messageId: d } : {},
|
|
46
|
+
...k ? { userProperties: o } : {},
|
|
47
|
+
properties: w,
|
|
48
|
+
metadata: S
|
|
42
49
|
}
|
|
43
50
|
});
|
|
44
51
|
}
|
|
45
52
|
try {
|
|
46
|
-
return await
|
|
53
|
+
return await n.onEvent?.(P);
|
|
47
54
|
} catch (e) {
|
|
48
55
|
console.warn("[events] onEvent callback threw", e);
|
|
49
56
|
}
|
|
50
57
|
},
|
|
51
58
|
[
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
n,
|
|
60
|
+
a,
|
|
61
|
+
t,
|
|
62
|
+
r,
|
|
55
63
|
v,
|
|
56
64
|
l,
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
i,
|
|
66
|
+
o
|
|
59
67
|
]
|
|
60
68
|
) };
|
|
61
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ T(j.Provider, { value: I, children: g });
|
|
62
70
|
};
|
|
63
71
|
export {
|
|
64
|
-
|
|
72
|
+
D as ChatBaseEventsProvider
|
|
65
73
|
};
|