@inkeep/agents-ui 0.17.1 → 0.17.2
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/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.js +1 -1
- package/dist/primitives/providers/chat-auth-provider.cjs +1 -1
- package/dist/primitives/providers/chat-auth-provider.js +26 -26
- package/dist/primitives/providers/chat-base-events-provider.cjs +1 -1
- package/dist/primitives/providers/chat-base-events-provider.js +1 -1
- package/package.json +1 -1
|
@@ -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.17.
|
|
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.17.2",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.17.
|
|
6
|
+
const { baseSettings: t, componentType: o } = x(), { tags: s, analyticsProperties: n } = t, r = "0.17.2", 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 y=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),l=require("react"),T=require("./config-provider.cjs"),S=require("../hooks/use-auth-token.cjs"),b=require("../components/embedded-chat/use-captcha.cjs"),P=require("../hooks/use-anonymous-session.cjs"),p=l.createContext(void 0),q=({children:t})=>{const{baseSettings:i,aiChatSettings:C}=T.useInkeepConfig(),{shouldBypassCaptcha:f,privacyPreferences:v}=i,{baseUrl:u,appId:a,apiKey:s}=C,{authToken:n,isLoading:o,refreshToken:g}=S.useAuthToken(),r=!!i.getAuthToken,e=!!n,{getCaptchaHeader:c,invalidate:h}=b.useCaptcha({baseUrl:u,appId:a,shouldBypassCaptcha:f||!!s||e||r&&o}),{sessionToken:A,refreshSession:d}=P.useAnonymousSession({baseUrl:u,appId:a,getCaptchaHeader:c,invalidateCaptcha:h,optOutAllAnalytics:v?.optOutAllAnalytics,enabled:!e&&!o}),k={authToken:n,isAuthenticated:e,isAuthLoading:o,isAuthConfigured:r,refreshAuthToken:g,sessionToken:A,refreshSession:d,getCaptchaHeader:c,invalidateCaptcha:h,effectiveAuthToken:s??(e?n:A),applicableRefreshSession:s||e?void 0:d};return y.jsx(p.Provider,{value:k,children:t})},x=()=>{const t=l.useContext(p);if(!t)throw new Error("useChatAuth must be used within a ChatAuthProvider");return t};exports.ChatAuthProvider=q;exports.useChatAuth=x;
|
|
@@ -5,37 +5,37 @@ import { useInkeepConfig as y } from "./config-provider.js";
|
|
|
5
5
|
import { useAuthToken as b } from "../hooks/use-auth-token.js";
|
|
6
6
|
import { useCaptcha as x } from "../components/embedded-chat/use-captcha.js";
|
|
7
7
|
import { useAnonymousSession as S } from "../hooks/use-anonymous-session.js";
|
|
8
|
-
const
|
|
9
|
-
const { baseSettings:
|
|
10
|
-
baseUrl:
|
|
11
|
-
appId:
|
|
12
|
-
shouldBypassCaptcha:
|
|
13
|
-
}), { sessionToken:
|
|
14
|
-
baseUrl:
|
|
15
|
-
appId:
|
|
16
|
-
getCaptchaHeader:
|
|
17
|
-
invalidateCaptcha:
|
|
18
|
-
optOutAllAnalytics:
|
|
19
|
-
enabled: !
|
|
8
|
+
const l = T(void 0), E = ({ children: e }) => {
|
|
9
|
+
const { baseSettings: i, aiChatSettings: A } = y(), { shouldBypassCaptcha: d, privacyPreferences: C } = i, { baseUrl: a, appId: r, apiKey: o } = A, { authToken: s, isLoading: n, refreshToken: m } = b(), h = !!i.getAuthToken, t = !!s, { getCaptchaHeader: u, invalidate: c } = x({
|
|
10
|
+
baseUrl: a,
|
|
11
|
+
appId: r,
|
|
12
|
+
shouldBypassCaptcha: d || !!o || t || h && n
|
|
13
|
+
}), { sessionToken: p, refreshSession: f } = S({
|
|
14
|
+
baseUrl: a,
|
|
15
|
+
appId: r,
|
|
16
|
+
getCaptchaHeader: u,
|
|
17
|
+
invalidateCaptcha: c,
|
|
18
|
+
optOutAllAnalytics: C?.optOutAllAnalytics,
|
|
19
|
+
enabled: !t && !n
|
|
20
20
|
}), v = {
|
|
21
21
|
authToken: s,
|
|
22
|
-
isAuthenticated:
|
|
23
|
-
isAuthLoading:
|
|
24
|
-
isAuthConfigured:
|
|
25
|
-
refreshAuthToken:
|
|
26
|
-
sessionToken:
|
|
27
|
-
refreshSession:
|
|
28
|
-
getCaptchaHeader:
|
|
29
|
-
invalidateCaptcha:
|
|
30
|
-
effectiveAuthToken: o ?? (
|
|
31
|
-
applicableRefreshSession: o ||
|
|
22
|
+
isAuthenticated: t,
|
|
23
|
+
isAuthLoading: n,
|
|
24
|
+
isAuthConfigured: h,
|
|
25
|
+
refreshAuthToken: m,
|
|
26
|
+
sessionToken: p,
|
|
27
|
+
refreshSession: f,
|
|
28
|
+
getCaptchaHeader: u,
|
|
29
|
+
invalidateCaptcha: c,
|
|
30
|
+
effectiveAuthToken: o ?? (t ? s : p),
|
|
31
|
+
applicableRefreshSession: o || t ? void 0 : f
|
|
32
32
|
};
|
|
33
|
-
return /* @__PURE__ */ k(
|
|
33
|
+
return /* @__PURE__ */ k(l.Provider, { value: v, children: e });
|
|
34
34
|
}, H = () => {
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
35
|
+
const e = g(l);
|
|
36
|
+
if (!e)
|
|
37
37
|
throw new Error("useChatAuth must be used within a ChatAuthProvider");
|
|
38
|
-
return
|
|
38
|
+
return e;
|
|
39
39
|
};
|
|
40
40
|
export {
|
|
41
41
|
E as ChatAuthProvider,
|
|
@@ -1 +1 @@
|
|
|
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.17.
|
|
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.17.2",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;
|
|
@@ -6,7 +6,7 @@ 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
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.17.
|
|
9
|
+
const { baseSettings: r, aiChatSettings: g, componentType: i } = N(), { tags: t, analyticsProperties: n, privacyPreferences: f, userProperties: o } = r, c = "0.17.2", a = x(
|
|
10
10
|
() => ({
|
|
11
11
|
widgetLibraryVersion: c,
|
|
12
12
|
componentType: i
|