@inkeep/cxkit-primitives 0.5.11 → 0.5.13
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/components/chat-button.cjs +1 -1
- package/dist/components/chat-button.d.cts +8 -1
- package/dist/components/chat-button.d.ts +8 -1
- package/dist/components/chat-button.js +31 -28
- package/dist/components/embedded-search/use-inkeep-search.cjs +1 -1
- package/dist/components/embedded-search/use-inkeep-search.d.cts +1 -1
- package/dist/components/embedded-search/use-inkeep-search.d.ts +1 -1
- package/dist/components/embedded-search/use-inkeep-search.js +22 -18
- package/dist/providers/base-events-provider.cjs +1 -1
- package/dist/providers/base-events-provider.js +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
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 d=require("react/jsx-runtime"),c=require("react"),f=require("@radix-ui/react-avatar"),n=require("./factory.cjs"),B=require("../atoms/avatars/ai.cjs"),_=require("../providers/config-provider.cjs"),p=require("../utils/compose-event-handlers.cjs"),A=require("@inkeep/cxkit-color-mode");function P(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const l=P(f),k=n.ikp("div",{_id:"chatButton__Container"}),b=n.ikp("button",{_id:"chatButton__Button"}),y=n.ikp("div",{_id:"chatButton__Text"}),S=n.ikp(l.Root,{_id:"chatButton__AvatarContent"}),j=n.ikp(l.Image,{_id:"chatButton__AvatarImage"}),g=c.memo(e=>{const{onLoadingStatusChange:a,avatar:t,...o}=e,{aiChatSettings:m}=_.useInkeepConfig(),{aiAssistantAvatar:r}=m??{},i=typeof t=="string"?t:A.useColorModeValue(t?.light,t?.dark),u=typeof r=="string"?r:r?.dark,[s,v]=c.useState(i??u);c.useEffect(()=>{v(i??u)},[i,u]);const C=h=>{h==="error"&&v(null)};return s?d.jsx(j,{src:s,"data-type":"image",onLoadingStatusChange:p.composeEventHandlers(a,C),...o}):d.jsx(B.default,{"data-type":"icon",...e})});exports.ChatButton=b;exports.ChatButtonAvatarContent=S;exports.ChatButtonAvatarImage=g;exports.ChatButtonContainer=k;exports.ChatButtonPrimitiveAvatarImage=g;exports.ChatButtonText=y;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentPropsWithRef, ForwardRefExoticComponent, DetailedHTMLProps, HTMLAttributes, ButtonHTMLAttributes, RefAttributes, MemoExoticComponent } from 'react';
|
|
2
|
+
import { InkeepAIChatSettings } from '@inkeep/cxkit-types';
|
|
2
3
|
import { PolymorphicProps } from './factory';
|
|
3
4
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
4
5
|
declare const ChatButtonPrimitiveContainer: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
|
|
@@ -6,6 +7,12 @@ declare const ChatButtonPrimitiveButton: ForwardRefExoticComponent< PolymorphicP
|
|
|
6
7
|
declare const ChatButtonPrimitiveText: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
|
|
7
8
|
declare const PrimitiveChatButtonAvatarContent: ForwardRefExoticComponent< PolymorphicProps & Omit<AvatarPrimitive.AvatarProps & RefAttributes<HTMLSpanElement>, "_id"> & Partial<Pick<AvatarPrimitive.AvatarProps & RefAttributes<HTMLSpanElement>, "_id">>>;
|
|
8
9
|
declare const PrimitiveChatButtonAvatarImage: ForwardRefExoticComponent< PolymorphicProps & Omit<AvatarPrimitive.AvatarImageProps & RefAttributes<HTMLImageElement>, "_id"> & Partial<Pick<AvatarPrimitive.AvatarImageProps & RefAttributes<HTMLImageElement>, "_id">>>;
|
|
9
|
-
type
|
|
10
|
+
type OnLoadingStatusChange = AvatarPrimitive.AvatarImageProps['onLoadingStatusChange'];
|
|
11
|
+
type AvatarImageProps = {
|
|
12
|
+
onLoadingStatusChange?: OnLoadingStatusChange;
|
|
13
|
+
} & (ComponentPropsWithRef<'svg'> | ComponentPropsWithRef<typeof PrimitiveChatButtonAvatarImage>);
|
|
14
|
+
type ChatButtonPrimitiveAvatarImageProps = AvatarImageProps & {
|
|
15
|
+
avatar?: InkeepAIChatSettings['aiAssistantAvatar'];
|
|
16
|
+
};
|
|
10
17
|
export declare const ChatButtonPrimitiveAvatarImage: MemoExoticComponent<(props: ChatButtonPrimitiveAvatarImageProps) => import("react/jsx-runtime").JSX.Element>;
|
|
11
18
|
export { ChatButtonPrimitiveContainer as ChatButtonContainer, ChatButtonPrimitiveText as ChatButtonText, ChatButtonPrimitiveButton as ChatButton, ChatButtonPrimitiveAvatarImage as ChatButtonAvatarImage, PrimitiveChatButtonAvatarContent as ChatButtonAvatarContent, };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentPropsWithRef, ForwardRefExoticComponent, DetailedHTMLProps, HTMLAttributes, ButtonHTMLAttributes, RefAttributes, MemoExoticComponent } from 'react';
|
|
2
|
+
import { InkeepAIChatSettings } from '@inkeep/cxkit-types';
|
|
2
3
|
import { PolymorphicProps } from './factory';
|
|
3
4
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
4
5
|
declare const ChatButtonPrimitiveContainer: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
|
|
@@ -6,6 +7,12 @@ declare const ChatButtonPrimitiveButton: ForwardRefExoticComponent< PolymorphicP
|
|
|
6
7
|
declare const ChatButtonPrimitiveText: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
|
|
7
8
|
declare const PrimitiveChatButtonAvatarContent: ForwardRefExoticComponent< PolymorphicProps & Omit<AvatarPrimitive.AvatarProps & RefAttributes<HTMLSpanElement>, "_id"> & Partial<Pick<AvatarPrimitive.AvatarProps & RefAttributes<HTMLSpanElement>, "_id">>>;
|
|
8
9
|
declare const PrimitiveChatButtonAvatarImage: ForwardRefExoticComponent< PolymorphicProps & Omit<AvatarPrimitive.AvatarImageProps & RefAttributes<HTMLImageElement>, "_id"> & Partial<Pick<AvatarPrimitive.AvatarImageProps & RefAttributes<HTMLImageElement>, "_id">>>;
|
|
9
|
-
type
|
|
10
|
+
type OnLoadingStatusChange = AvatarPrimitive.AvatarImageProps['onLoadingStatusChange'];
|
|
11
|
+
type AvatarImageProps = {
|
|
12
|
+
onLoadingStatusChange?: OnLoadingStatusChange;
|
|
13
|
+
} & (ComponentPropsWithRef<'svg'> | ComponentPropsWithRef<typeof PrimitiveChatButtonAvatarImage>);
|
|
14
|
+
type ChatButtonPrimitiveAvatarImageProps = AvatarImageProps & {
|
|
15
|
+
avatar?: InkeepAIChatSettings['aiAssistantAvatar'];
|
|
16
|
+
};
|
|
10
17
|
export declare const ChatButtonPrimitiveAvatarImage: MemoExoticComponent<(props: ChatButtonPrimitiveAvatarImageProps) => import("react/jsx-runtime").JSX.Element>;
|
|
11
18
|
export { ChatButtonPrimitiveContainer as ChatButtonContainer, ChatButtonPrimitiveText as ChatButtonText, ChatButtonPrimitiveButton as ChatButton, ChatButtonPrimitiveAvatarImage as ChatButtonAvatarImage, PrimitiveChatButtonAvatarContent as ChatButtonAvatarContent, };
|
|
@@ -1,42 +1,45 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { memo as
|
|
4
|
-
import * as
|
|
2
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
3
|
+
import { memo as g, useState as d, useEffect as B } from "react";
|
|
4
|
+
import * as u from "@radix-ui/react-avatar";
|
|
5
5
|
import { ikp as t } from "./factory.js";
|
|
6
|
-
import
|
|
7
|
-
import { useInkeepConfig as
|
|
8
|
-
import { composeEventHandlers as
|
|
9
|
-
|
|
6
|
+
import f from "../atoms/avatars/ai.js";
|
|
7
|
+
import { useInkeepConfig as _ } from "../providers/config-provider.js";
|
|
8
|
+
import { composeEventHandlers as p } from "../utils/compose-event-handlers.js";
|
|
9
|
+
import { useColorModeValue as A } from "@inkeep/cxkit-color-mode";
|
|
10
|
+
const b = t("div", {
|
|
10
11
|
_id: "chatButton__Container"
|
|
11
|
-
}),
|
|
12
|
+
}), E = t("button", {
|
|
12
13
|
_id: "chatButton__Button"
|
|
13
|
-
}),
|
|
14
|
+
}), U = t("div", {
|
|
14
15
|
_id: "chatButton__Text"
|
|
15
|
-
}),
|
|
16
|
+
}), j = t(u.Root, {
|
|
16
17
|
_id: "chatButton__AvatarContent"
|
|
17
|
-
}),
|
|
18
|
+
}), l = t(u.Image, {
|
|
18
19
|
_id: "chatButton__AvatarImage"
|
|
19
|
-
}),
|
|
20
|
-
const { onLoadingStatusChange:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
}), H = g((r) => {
|
|
21
|
+
const { onLoadingStatusChange: c, avatar: a, ...h } = r, { aiChatSettings: v } = _(), { aiAssistantAvatar: o } = v ?? {}, n = typeof a == "string" ? a : A(a?.light, a?.dark), i = typeof o == "string" ? o : o?.dark, [e, s] = d(
|
|
22
|
+
n ?? i
|
|
23
|
+
);
|
|
24
|
+
return B(() => {
|
|
25
|
+
s(n ?? i);
|
|
26
|
+
}, [n, i]), e ? /* @__PURE__ */ m(
|
|
27
|
+
l,
|
|
25
28
|
{
|
|
26
|
-
src:
|
|
29
|
+
src: e,
|
|
27
30
|
"data-type": "image",
|
|
28
|
-
onLoadingStatusChange:
|
|
29
|
-
C === "error" &&
|
|
31
|
+
onLoadingStatusChange: p(c, (C) => {
|
|
32
|
+
C === "error" && s(null);
|
|
30
33
|
}),
|
|
31
|
-
...
|
|
34
|
+
...h
|
|
32
35
|
}
|
|
33
|
-
) : /* @__PURE__ */
|
|
36
|
+
) : /* @__PURE__ */ m(f, { "data-type": "icon", ...r });
|
|
34
37
|
});
|
|
35
38
|
export {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
E as ChatButton,
|
|
40
|
+
j as ChatButtonAvatarContent,
|
|
41
|
+
H as ChatButtonAvatarImage,
|
|
42
|
+
b as ChatButtonContainer,
|
|
43
|
+
H as ChatButtonPrimitiveAvatarImage,
|
|
44
|
+
U as ChatButtonText
|
|
42
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),W=require("../../providers/config-provider.cjs"),G=require("../../hooks/use-media-query.cjs"),J=require("./search-query.graphql.cjs"),V=require("./transform-results.cjs"),X=require("../../providers/search-events-provider.cjs"),Y=require("../../hooks/use-instant-update.cjs"),Z=require("../../utils/graphql-client.cjs"),ee=()=>{const{baseSettings:_,searchSettings:j}=W.useInkeepConfig(),{apiKey:p,aiApiBaseUrl:L,userAuthToken:l}=_,{maxResults:
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),W=require("../../providers/config-provider.cjs"),G=require("../../hooks/use-media-query.cjs"),J=require("./search-query.graphql.cjs"),V=require("./transform-results.cjs"),X=require("../../providers/search-events-provider.cjs"),Y=require("../../hooks/use-instant-update.cjs"),Z=require("../../utils/graphql-client.cjs"),ee=()=>{const{baseSettings:_,searchSettings:j}=W.useInkeepConfig(),{apiKey:p,aiApiBaseUrl:L,userAuthToken:l}=_,{maxResults:S,placeholder:R,defaultQuery:N,debounceTimeMs:Q,onQueryChange:O,searchFunctionsRef:x}=j,{logEvent:q}=X.useSearchEvents(),[c,C]=t.useState(N),T=t.useRef(null),[k,v]=t.useState(!1),[B,i]=t.useState(null),[F,a]=t.useState("NONE"),H=t.useCallback(e=>{a(e)},[]),[h,d]=t.useState([]),s=V.useTransformResults(h,c),[f,E]=t.useState("All"),{disableTransition:M,disabled:$}=Y.useInstantUpdate(),z=t.useCallback(e=>{M(),E(e);const r=s[e][0].id;setTimeout(()=>{a(r)},0)},[s,M]);t.useEffect(()=>{let e=f in s?f:Object.keys(s)[0];if(!s[e]?.length){const n=Object.keys(s).find(u=>s[u]?.length);n?e=n:e="All"}if(!e)return;E(e);const r=s[e]?.[0];r&&a(r.id)},[s]);const y=G.useMediaQuery("(max-width: 768px)"),o=t.useRef({}),b=t.useRef(null),m=t.useRef(null);t.useImperativeHandle(x,()=>({updateQuery(e){C(e)},focusInput:()=>{T.current?.focus()}}));const w=`${L}/graphql`,A=t.useMemo(()=>({Authorization:`Bearer ${p}`,"Content-Type":"application/json",...l?{"User-Token":l}:{}}),[p,l]),I=t.useCallback(async e=>{b.current&&b.current.abort();const r=new AbortController;b.current=r;try{v(!0),i(null);const u=(await Z.graphqlRequest(w,J.default,{searchInput:e},A))?.search.searchHits;o.current[e.searchQuery]=u,d(u)}catch(n){if(n.name==="AbortError")return;i("Failed to fetch search results. Please try again.")}v(!1)},[w,A]),P=t.useCallback(e=>{const r=o.current[e.searchQuery];q({eventName:"search_query_response_received",properties:{searchQuery:e.searchQuery,totalResults:r?.length}})},[]),U=t.useCallback(e=>{if(m.current&&window.clearTimeout(m.current),!e.searchQuery){d([]),i(null);return}m.current=window.setTimeout(()=>{q({eventName:"search_query_submitted",properties:{searchQuery:e.searchQuery}}),o.current[e.searchQuery]?(d(o.current[e.searchQuery]),P(e)):I(e).then(()=>{P(e)})},Q)},[Q,I]),g=t.useMemo(()=>({searchQuery:c,filters:{limit:S}}),[c,S]);t.useEffect(()=>{O?.(g.searchQuery),U(g)},[U,g]);const D=t.useCallback(e=>C(e.target.value),[]),K=t.useMemo(()=>R||(y?"Search...":"Search for anything..."),[R,y]);return{results:s,resultsList:h,hasContent:h.length>0||k,loading:k,error:B,query:c,onInput:D,placeholder:K,tab:f,onTabChange:z,selectedItem:F,setSelectedItem:a,onSelectedItemChange:H,transitionsDisabled:$,inputRef:T,isMobile:y}};exports.useInkeepSearch=ee;
|
|
@@ -11,7 +11,7 @@ export declare const useInkeepSearch: () => {
|
|
|
11
11
|
onInput: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
12
12
|
placeholder: string;
|
|
13
13
|
tab: string;
|
|
14
|
-
onTabChange: (
|
|
14
|
+
onTabChange: (newTab: string) => void;
|
|
15
15
|
selectedItem: string | undefined;
|
|
16
16
|
setSelectedItem: Dispatch<SetStateAction<string | undefined>>;
|
|
17
17
|
onSelectedItemChange: (value: string) => void;
|
|
@@ -11,7 +11,7 @@ export declare const useInkeepSearch: () => {
|
|
|
11
11
|
onInput: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
12
12
|
placeholder: string;
|
|
13
13
|
tab: string;
|
|
14
|
-
onTabChange: (
|
|
14
|
+
onTabChange: (newTab: string) => void;
|
|
15
15
|
selectedItem: string | undefined;
|
|
16
16
|
setSelectedItem: Dispatch<SetStateAction<string | undefined>>;
|
|
17
17
|
onSelectedItemChange: (value: string) => void;
|
|
@@ -12,29 +12,33 @@ const me = () => {
|
|
|
12
12
|
maxResults: S,
|
|
13
13
|
placeholder: C,
|
|
14
14
|
defaultQuery: H,
|
|
15
|
-
debounceTimeMs:
|
|
15
|
+
debounceTimeMs: v,
|
|
16
16
|
onQueryChange: P,
|
|
17
17
|
searchFunctionsRef: $
|
|
18
|
-
} = B, { logEvent:
|
|
18
|
+
} = B, { logEvent: k } = re(), [c, w] = s(H), A = l(null), [q, E] = s(!1), [z, f] = s(null), [D, a] = s("NONE"), K = n((e) => {
|
|
19
19
|
a(e);
|
|
20
|
-
}, []), [m, d] = s([]), t = te(m, c), [p,
|
|
20
|
+
}, []), [m, d] = s([]), t = te(m, c), [p, I] = s("All"), { disableTransition: _, disabled: W } = se(), G = n(
|
|
21
21
|
(e) => {
|
|
22
|
-
|
|
22
|
+
_(), I(e);
|
|
23
|
+
const r = t[e][0].id;
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
a(r);
|
|
26
|
+
}, 0);
|
|
23
27
|
},
|
|
24
|
-
[t,
|
|
28
|
+
[t, _]
|
|
25
29
|
);
|
|
26
30
|
j(() => {
|
|
27
31
|
let e = p in t ? p : Object.keys(t)[0];
|
|
28
32
|
if (!t[e]?.length) {
|
|
29
|
-
const o = Object.keys(t).find((
|
|
33
|
+
const o = Object.keys(t).find((i) => t[i]?.length);
|
|
30
34
|
o ? e = o : e = "All";
|
|
31
35
|
}
|
|
32
36
|
if (!e) return;
|
|
33
|
-
|
|
37
|
+
I(e);
|
|
34
38
|
const r = t[e]?.[0];
|
|
35
39
|
r && a(r.id);
|
|
36
40
|
}, [t]);
|
|
37
|
-
const y = Z("(max-width: 768px)"),
|
|
41
|
+
const y = Z("(max-width: 768px)"), u = l({}), b = l(null), g = l(null);
|
|
38
42
|
X($, () => ({
|
|
39
43
|
updateQuery(e) {
|
|
40
44
|
w(e);
|
|
@@ -43,7 +47,7 @@ const me = () => {
|
|
|
43
47
|
A.current?.focus();
|
|
44
48
|
}
|
|
45
49
|
}));
|
|
46
|
-
const
|
|
50
|
+
const x = `${F}/graphql`, L = R(
|
|
47
51
|
() => ({
|
|
48
52
|
Authorization: `Bearer ${T}`,
|
|
49
53
|
"Content-Type": "application/json",
|
|
@@ -57,8 +61,8 @@ const me = () => {
|
|
|
57
61
|
b.current = r;
|
|
58
62
|
try {
|
|
59
63
|
E(!0), f(null);
|
|
60
|
-
const
|
|
61
|
-
|
|
64
|
+
const i = (await ne(x, ee, { searchInput: e }, L))?.search.searchHits;
|
|
65
|
+
u.current[e.searchQuery] = i, d(i);
|
|
62
66
|
} catch (o) {
|
|
63
67
|
if (o.name === "AbortError")
|
|
64
68
|
return;
|
|
@@ -66,10 +70,10 @@ const me = () => {
|
|
|
66
70
|
}
|
|
67
71
|
E(!1);
|
|
68
72
|
},
|
|
69
|
-
[
|
|
73
|
+
[x, L]
|
|
70
74
|
), N = n((e) => {
|
|
71
|
-
const r =
|
|
72
|
-
|
|
75
|
+
const r = u.current[e.searchQuery];
|
|
76
|
+
k({
|
|
73
77
|
eventName: "search_query_response_received",
|
|
74
78
|
properties: {
|
|
75
79
|
searchQuery: e.searchQuery,
|
|
@@ -83,17 +87,17 @@ const me = () => {
|
|
|
83
87
|
return;
|
|
84
88
|
}
|
|
85
89
|
g.current = window.setTimeout(() => {
|
|
86
|
-
|
|
90
|
+
k({
|
|
87
91
|
eventName: "search_query_submitted",
|
|
88
92
|
properties: {
|
|
89
93
|
searchQuery: e.searchQuery
|
|
90
94
|
}
|
|
91
|
-
}),
|
|
95
|
+
}), u.current[e.searchQuery] ? (d(u.current[e.searchQuery]), N(e)) : M(e).then(() => {
|
|
92
96
|
N(e);
|
|
93
97
|
});
|
|
94
|
-
},
|
|
98
|
+
}, v);
|
|
95
99
|
},
|
|
96
|
-
[
|
|
100
|
+
[v, M]
|
|
97
101
|
), Q = R(
|
|
98
102
|
() => ({
|
|
99
103
|
searchQuery: c,
|
|
@@ -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.13",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.13",
|
|
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.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Inkeep, Inc. Customer License (IICL) v1.1",
|
|
6
6
|
"homepage": "",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"cmdk": "1.0.4",
|
|
44
44
|
"dequal": "^2.0.3",
|
|
45
45
|
"humps": "2.0.1",
|
|
46
|
-
"merge-anything": "
|
|
46
|
+
"merge-anything": "5.1.7",
|
|
47
47
|
"openai": "4.78.1",
|
|
48
48
|
"prism-react-renderer": "2.4.1",
|
|
49
49
|
"react-hook-form": "7.54.2",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"react-textarea-autosize": "8.5.7",
|
|
55
55
|
"rehype-raw": "7.0.0",
|
|
56
56
|
"unist-util-visit": "^5.0.0",
|
|
57
|
-
"@inkeep/cxkit-color-mode": "0.5.
|
|
58
|
-
"@inkeep/cxkit-theme": "0.5.
|
|
59
|
-
"@inkeep/cxkit-types": "0.5.
|
|
57
|
+
"@inkeep/cxkit-color-mode": "0.5.13",
|
|
58
|
+
"@inkeep/cxkit-theme": "0.5.13",
|
|
59
|
+
"@inkeep/cxkit-types": "0.5.13"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@biomejs/biome": "1.9.4",
|