@inkeep/agents-ui 0.16.3 → 0.16.4

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 r=require("react"),f=require("./use-inkeep-api-client.cjs"),g=()=>{};function h({baseUrl:e,appId:a,authToken:t,getCaptchaHeader:u,invalidateCaptcha:l,refreshSession:p,headers:i}){const{fetchWithAuth:o}=f.useInkeepApiClient({appId:a,authToken:t,getCaptchaHeader:u,invalidateCaptcha:l??g,refreshSession:p}),c=r.useRef(i);return c.current=i,{logEvent:r.useCallback(async({body:v})=>{if(!(!e||!t))try{const n=`${e}/run/v1/events`,s=await o(n,{method:"POST",headers:{"Content-Type":"application/json",...c.current},body:JSON.stringify(v)});if(!s.ok){const d=await s.text().catch(()=>"<unreadable>");console.warn(`[events-api] log failed: ${s.status}`,d)}}catch(n){console.warn("[events-api] log threw",n)}},[e,t,o])}}exports.useEventsApi=h;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),f=require("./use-inkeep-api-client.cjs"),h=()=>{};function g({baseUrl:e,appId:a,authToken:r,getCaptchaHeader:u,invalidateCaptcha:l,refreshSession:p,headers:o}){const{fetchWithAuth:s}=f.useInkeepApiClient({appId:a,authToken:r,getCaptchaHeader:u,invalidateCaptcha:l??h,refreshSession:p}),i=c.useRef(o);return i.current=o,{logEvent:c.useCallback(async({body:v})=>{if(e)try{const t=`${e}/run/v1/events`,n=await s(t,{method:"POST",headers:{"Content-Type":"application/json",...i.current},body:JSON.stringify(v)});if(!n.ok){const d=await n.text().catch(()=>"<unreadable>");console.warn(`[events-api] log failed: ${n.status}`,d)}}catch(t){console.warn("[events-api] log threw",t)}},[e,s])}}exports.useEventsApi=g;
@@ -1,42 +1,42 @@
1
1
  "use client";
2
- import { useRef as v, useCallback as d } from "react";
3
- import { useInkeepApiClient as h } from "./use-inkeep-api-client.js";
2
+ import { useRef as h, useCallback as v } from "react";
3
+ import { useInkeepApiClient as d } from "./use-inkeep-api-client.js";
4
4
  const g = () => {
5
5
  };
6
6
  function C({
7
7
  baseUrl: t,
8
- appId: i,
9
- authToken: e,
10
- getCaptchaHeader: a,
11
- invalidateCaptcha: l,
12
- refreshSession: p,
13
- headers: r
8
+ appId: s,
9
+ authToken: c,
10
+ getCaptchaHeader: i,
11
+ invalidateCaptcha: u,
12
+ refreshSession: l,
13
+ headers: o
14
14
  }) {
15
- const { fetchWithAuth: s } = h({
16
- appId: i,
17
- authToken: e,
18
- getCaptchaHeader: a,
19
- invalidateCaptcha: l ?? g,
20
- refreshSession: p
21
- }), c = v(r);
22
- return c.current = r, { logEvent: d(
23
- async ({ body: u }) => {
24
- if (!(!t || !e))
15
+ const { fetchWithAuth: a } = d({
16
+ appId: s,
17
+ authToken: c,
18
+ getCaptchaHeader: i,
19
+ invalidateCaptcha: u ?? g,
20
+ refreshSession: l
21
+ }), r = h(o);
22
+ return r.current = o, { logEvent: v(
23
+ async ({ body: p }) => {
24
+ if (t)
25
25
  try {
26
- const n = `${t}/run/v1/events`, o = await s(n, {
26
+ const e = `${t}/run/v1/events`, n = await a(e, {
27
27
  method: "POST",
28
- headers: { "Content-Type": "application/json", ...c.current },
29
- body: JSON.stringify(u)
28
+ headers: { "Content-Type": "application/json", ...r.current },
29
+ body: JSON.stringify(p)
30
30
  });
31
- if (!o.ok) {
32
- const f = await o.text().catch(() => "<unreadable>");
33
- console.warn(`[events-api] log failed: ${o.status}`, f);
31
+ if (!n.ok) {
32
+ const f = await n.text().catch(() => "<unreadable>");
33
+ console.warn(`[events-api] log failed: ${n.status}`, f);
34
34
  }
35
- } catch (n) {
36
- console.warn("[events-api] log threw", n);
35
+ } catch (e) {
36
+ console.warn("[events-api] log threw", e);
37
37
  }
38
38
  },
39
- [t, e, s]
39
+ [t, a]
40
40
  ) };
41
41
  }
42
42
  export {
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),y=require("./use-inkeep-api-client.cjs"),h=()=>{};function m({baseUrl:e,appId:o,authToken:t,getCaptchaHeader:u,invalidateCaptcha:a,refreshSession:d,headers:i}){const{fetchWithAuth:s}=y.useInkeepApiClient({appId:o,authToken:t,getCaptchaHeader:u,invalidateCaptcha:a??h,refreshSession:d}),c=r.useRef(i);return c.current=i,{submitFeedback:r.useCallback(async({conversationId:p,messageId:b,type:f,details:l})=>{if(!e||!t)return;const k=`${e}/run/v1/feedback`,n=await s(k,{method:"POST",headers:{"Content-Type":"application/json",...c.current},body:JSON.stringify({conversationId:p,messageId:b,type:f,details:l})});if(!n.ok)throw new Error(`Feedback submission failed: ${n.status}`);return n.json()},[e,t,s])}}exports.useFeedbackApi=m;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),h=require("./use-inkeep-api-client.cjs"),y=()=>{};function m({baseUrl:e,appId:o,authToken:r,getCaptchaHeader:u,invalidateCaptcha:a,refreshSession:d,headers:n}){const{fetchWithAuth:i}=h.useInkeepApiClient({appId:o,authToken:r,getCaptchaHeader:u,invalidateCaptcha:a??y,refreshSession:d}),s=c.useRef(n);return s.current=n,{submitFeedback:c.useCallback(async({conversationId:p,messageId:b,type:f,details:k})=>{if(!e)return;const l=`${e}/run/v1/feedback`,t=await i(l,{method:"POST",headers:{"Content-Type":"application/json",...s.current},body:JSON.stringify({conversationId:p,messageId:b,type:f,details:k})});if(!t.ok)throw new Error(`Feedback submission failed: ${t.status}`);return t.json()},[e,i])}}exports.useFeedbackApi=m;
@@ -1,36 +1,36 @@
1
1
  "use client";
2
- import { useRef as k, useCallback as l } from "react";
3
- import { useInkeepApiClient as h } from "./use-inkeep-api-client.js";
2
+ import { useRef as m, useCallback as h } from "react";
3
+ import { useInkeepApiClient as l } from "./use-inkeep-api-client.js";
4
4
  const y = () => {
5
5
  };
6
6
  function A({
7
7
  baseUrl: e,
8
- appId: s,
9
- authToken: t,
8
+ appId: r,
9
+ authToken: s,
10
10
  getCaptchaHeader: c,
11
11
  invalidateCaptcha: u,
12
12
  refreshSession: a,
13
- headers: i
13
+ headers: n
14
14
  }) {
15
- const { fetchWithAuth: o } = h({
16
- appId: s,
17
- authToken: t,
15
+ const { fetchWithAuth: o } = l({
16
+ appId: r,
17
+ authToken: s,
18
18
  getCaptchaHeader: c,
19
19
  invalidateCaptcha: u ?? y,
20
20
  refreshSession: a
21
- }), r = k(i);
22
- return r.current = i, { submitFeedback: l(
21
+ }), i = m(n);
22
+ return i.current = n, { submitFeedback: h(
23
23
  async ({ conversationId: f, messageId: p, type: d, details: b }) => {
24
- if (!e || !t) return;
25
- const m = `${e}/run/v1/feedback`, n = await o(m, {
24
+ if (!e) return;
25
+ const k = `${e}/run/v1/feedback`, t = await o(k, {
26
26
  method: "POST",
27
- headers: { "Content-Type": "application/json", ...r.current },
27
+ headers: { "Content-Type": "application/json", ...i.current },
28
28
  body: JSON.stringify({ conversationId: f, messageId: p, type: d, details: b })
29
29
  });
30
- if (!n.ok) throw new Error(`Feedback submission failed: ${n.status}`);
31
- return n.json();
30
+ if (!t.ok) throw new Error(`Feedback submission failed: ${t.status}`);
31
+ return t.json();
32
32
  },
33
- [e, t, o]
33
+ [e, o]
34
34
  ) };
35
35
  }
36
36
  export {
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),t=require("react"),p=require("./config-provider.cjs"),n=t.createContext(void 0),g=({children:e})=>{const{baseSettings:s,componentType:o}=p.useInkeepConfig(),{tags:r,analyticsProperties:i}=s,c="0.16.3",a=t.useMemo(()=>({widgetLibraryVersion:c,componentType:o,tags:r}),[o,r,c]),v={logEvent:t.useCallback(async u=>{const E={...a,...u.properties,...i},d={eventName:u.eventName,properties:E};return s.onEvent?.(d)},[s,a,i])};return l.jsx(n.Provider,{value:v,children:e})},m=()=>{const e=t.useContext(n);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsContext=n;exports.BaseEventsProvider=g;exports.useBaseEvents=m;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),t=require("react"),p=require("./config-provider.cjs"),n=t.createContext(void 0),g=({children:e})=>{const{baseSettings:s,componentType:o}=p.useInkeepConfig(),{tags:r,analyticsProperties:i}=s,c="0.16.4",a=t.useMemo(()=>({widgetLibraryVersion:c,componentType:o,tags:r}),[o,r,c]),v={logEvent:t.useCallback(async u=>{const E={...a,...u.properties,...i},d={eventName:u.eventName,properties:E};return s.onEvent?.(d)},[s,a,i])};return l.jsx(n.Provider,{value:v,children:e})},m=()=>{const e=t.useContext(n);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsContext=n;exports.BaseEventsProvider=g;exports.useBaseEvents=m;
@@ -3,7 +3,7 @@ import { jsx as u } from "react/jsx-runtime";
3
3
  import { createContext as E, useMemo as d, useCallback as l, useContext as g } from "react";
4
4
  import { useInkeepConfig as x } from "./config-provider.js";
5
5
  const c = E(void 0), b = ({ children: e }) => {
6
- const { baseSettings: t, componentType: o } = x(), { tags: s, analyticsProperties: n } = t, r = "0.16.3", i = d(
6
+ const { baseSettings: t, componentType: o } = x(), { tags: s, analyticsProperties: n } = t, r = "0.16.4", i = d(
7
7
  () => ({
8
8
  widgetLibraryVersion: r,
9
9
  componentType: o,
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("react/jsx-runtime"),g=require("react"),B=require("./config-provider.cjs"),O=require("./chat-auth-provider.cjs"),U=require("../hooks/use-events-api.cjs"),x=require("./base-events-provider.cjs"),M=({children:h})=>{const{baseSettings:n,aiChatSettings:y,componentType:c}=B.useInkeepConfig(),{tags:t,analyticsProperties:r,privacyPreferences:b,userProperties:o}=n,p="0.16.3",a=g.useMemo(()=>({widgetLibraryVersion:p,componentType:c}),[c,p]),{effectiveAuthToken:i,applicableRefreshSession:f,getCaptchaHeader:E,invalidateCaptcha:P}=O.useChatAuth(),{baseUrl:m,appId:A,analyticsApiBaseUrl:C,headers:I}=y,l=b?.optOutAllAnalytics??!1,{logEvent:v}=U.useEventsApi({baseUrl:C??m,appId:A,authToken:i,getCaptchaHeader:E,invalidateCaptcha:P,refreshSession:f,headers:I}),k={logEvent:g.useCallback(async s=>{const q={eventName:s.eventName,properties:{...a,...t?{tags:t}:{},...s.properties,...r}};if(!l&&i){const e=s.properties??{},d=typeof e.conversationId=="string"?e.conversationId:void 0,u=typeof e.messageId=="string"?e.messageId:void 0,S=!!o&&Object.keys(o).length>0,w={...t?{tags:t}:{},...r??{}},T={...a,...s.properties};v({body:{type:s.eventName,...d?{conversationId:d}:{},...u?{messageId:u}:{},...S?{userProperties:o}:{},properties:w,metadata:T}})}try{return await n.onEvent?.(q)}catch(e){console.warn("[events] onEvent callback threw",e)}},[n,a,t,r,v,l,i,o])};return j.jsx(x.BaseEventsContext.Provider,{value:k,children:h})};exports.ChatBaseEventsProvider=M;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("react/jsx-runtime"),u=require("react"),B=require("./config-provider.cjs"),O=require("./chat-auth-provider.cjs"),U=require("../hooks/use-events-api.cjs"),x=require("./base-events-provider.cjs"),M=({children:g})=>{const{baseSettings:n,aiChatSettings:h,componentType:i}=B.useInkeepConfig(),{tags:t,analyticsProperties:r,privacyPreferences:y,userProperties:o}=n,c="0.16.4",a=u.useMemo(()=>({widgetLibraryVersion:c,componentType:i}),[i,c]),{effectiveAuthToken:b,applicableRefreshSession:f,getCaptchaHeader:E,invalidateCaptcha:P}=O.useChatAuth(),{baseUrl:m,appId:A,analyticsApiBaseUrl:C,headers:I}=h,p=y?.optOutAllAnalytics??!1,{logEvent:l}=U.useEventsApi({baseUrl:C??m,appId:A,authToken:b,getCaptchaHeader:E,invalidateCaptcha:P,refreshSession:f,headers:I}),k={logEvent:u.useCallback(async s=>{const q={eventName:s.eventName,properties:{...a,...t?{tags:t}:{},...s.properties,...r}};if(!p){const e=s.properties??{},v=typeof e.conversationId=="string"?e.conversationId:void 0,d=typeof e.messageId=="string"?e.messageId:void 0,S=!!o&&Object.keys(o).length>0,w={...t?{tags:t}:{},...r??{}},T={...a,...s.properties};l({body:{type:s.eventName,...v?{conversationId:v}:{},...d?{messageId:d}:{},...S?{userProperties:o}:{},properties:w,metadata:T}})}try{return await n.onEvent?.(q)}catch(e){console.warn("[events] onEvent callback threw",e)}},[n,a,t,r,l,p,o])};return j.jsx(x.BaseEventsContext.Provider,{value:k,children:g})};exports.ChatBaseEventsProvider=M;
@@ -5,17 +5,17 @@ import { useInkeepConfig as N } from "./config-provider.js";
5
5
  import { useChatAuth as O } from "./chat-auth-provider.js";
6
6
  import { useEventsApi as j } from "../hooks/use-events-api.js";
7
7
  import { BaseEventsContext as M } from "./base-events-provider.js";
8
- const F = ({ children: g }) => {
9
- const { baseSettings: r, aiChatSettings: f, componentType: c } = N(), { tags: t, analyticsProperties: n, privacyPreferences: h, userProperties: o } = r, p = "0.16.3", a = x(
8
+ const F = ({ children: m }) => {
9
+ const { baseSettings: r, aiChatSettings: g, componentType: i } = N(), { tags: t, analyticsProperties: n, privacyPreferences: f, userProperties: o } = r, c = "0.16.4", a = x(
10
10
  () => ({
11
- widgetLibraryVersion: p,
12
- componentType: c
11
+ widgetLibraryVersion: c,
12
+ componentType: i
13
13
  }),
14
- [c, p]
15
- ), { effectiveAuthToken: i, applicableRefreshSession: u, getCaptchaHeader: y, invalidateCaptcha: b } = O(), { baseUrl: A, appId: E, analyticsApiBaseUrl: C, headers: I } = f, l = h?.optOutAllAnalytics ?? !1, { logEvent: v } = j({
14
+ [i, c]
15
+ ), { effectiveAuthToken: h, applicableRefreshSession: u, getCaptchaHeader: y, invalidateCaptcha: b } = O(), { baseUrl: A, appId: E, analyticsApiBaseUrl: C, headers: I } = g, p = f?.optOutAllAnalytics ?? !1, { logEvent: l } = j({
16
16
  baseUrl: C ?? A,
17
17
  appId: E,
18
- authToken: i,
18
+ authToken: h,
19
19
  getCaptchaHeader: y,
20
20
  invalidateCaptcha: b,
21
21
  refreshSession: u,
@@ -31,19 +31,19 @@ const F = ({ children: g }) => {
31
31
  ...n
32
32
  }
33
33
  };
34
- if (!l && i) {
35
- const e = s.properties ?? {}, d = typeof e.conversationId == "string" ? e.conversationId : void 0, m = typeof e.messageId == "string" ? e.messageId : void 0, w = !!o && Object.keys(o).length > 0, S = {
34
+ if (!p) {
35
+ const e = s.properties ?? {}, v = typeof e.conversationId == "string" ? e.conversationId : void 0, d = typeof e.messageId == "string" ? e.messageId : void 0, w = !!o && Object.keys(o).length > 0, S = {
36
36
  ...t ? { tags: t } : {},
37
37
  ...n ?? {}
38
38
  }, T = {
39
39
  ...a,
40
40
  ...s.properties
41
41
  };
42
- v({
42
+ l({
43
43
  body: {
44
44
  type: s.eventName,
45
- ...d ? { conversationId: d } : {},
46
- ...m ? { messageId: m } : {},
45
+ ...v ? { conversationId: v } : {},
46
+ ...d ? { messageId: d } : {},
47
47
  ...w ? { userProperties: o } : {},
48
48
  properties: S,
49
49
  metadata: T
@@ -61,13 +61,12 @@ const F = ({ children: g }) => {
61
61
  a,
62
62
  t,
63
63
  n,
64
- v,
65
64
  l,
66
- i,
65
+ p,
67
66
  o
68
67
  ]
69
68
  ) };
70
- return /* @__PURE__ */ U(M.Provider, { value: P, children: g });
69
+ return /* @__PURE__ */ U(M.Provider, { value: P, children: m });
71
70
  };
72
71
  export {
73
72
  F as ChatBaseEventsProvider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-ui",
3
- "version": "0.16.3",
3
+ "version": "0.16.4",
4
4
  "description": "",
5
5
  "homepage": "",
6
6
  "repository": {