@inkeep/cxkit-primitives 0.5.23 → 0.5.25

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"),J=require("../../providers/config-provider.cjs"),V=require("../../hooks/use-media-query.cjs"),X=require("./search-query.graphql.cjs"),Y=require("./transform-results.cjs"),Z=require("../../providers/search-events-provider.cjs"),ee=require("../../hooks/use-instant-update.cjs"),te=require("../../utils/graphql-client.cjs"),se=()=>{const{baseSettings:L,searchSettings:N}=J.useInkeepConfig(),{apiKey:S,aiApiBaseUrl:O,userAuthToken:l}=L,{maxResults:R,placeholder:Q,defaultQuery:x,debounceTimeMs:q,onQueryChange:B,searchFunctionsRef:F,tabs:i}=N,{logEvent:C}=Z.useSearchEvents(),[c,T]=t.useState(x),k=t.useRef(null),[v,E]=t.useState(!1),[H,h]=t.useState(null),[$,a]=t.useState("NONE"),z=t.useCallback(e=>{a(e)},[]),[d,f]=t.useState([]),s=Y.useTransformResults(d,c),M=typeof i?.[0]=="string"?i[0]:i[0][0],[y,w]=t.useState(M),{disableTransition:I,disabled:D}=ee.useInstantUpdate(),K=t.useCallback(e=>{I(),w(e);const r=s[e][0].id;a(r)},[s,I]);t.useEffect(()=>{let e=y in s?y:Object.keys(s)[0];if(!s[e]?.length){const n=Object.keys(s).find(u=>s[u]?.length);n?e=n:e=M}if(!e)return;w(e);const r=s[e]?.[0];r&&a(r.id)},[s]);const b=V.useMediaQuery("(max-width: 768px)"),o=t.useRef({}),m=t.useRef(null),g=t.useRef(null);t.useImperativeHandle(F,()=>({updateQuery(e){T(e)},focusInput:()=>{k.current?.focus()}}));const A=`${O}/graphql`,P=t.useMemo(()=>({Authorization:`Bearer ${S}`,"Content-Type":"application/json",...l?{"User-Token":l}:{}}),[S,l]),U=t.useCallback(async e=>{m.current&&m.current.abort();const r=new AbortController;m.current=r;try{E(!0),h(null);const u=(await te.graphqlRequest(A,X.default,{searchInput:e},P))?.search.searchHits;o.current[e.searchQuery]=u,f(u)}catch(n){if(n.name==="AbortError")return;h("Failed to fetch search results. Please try again.")}E(!1)},[A,P]),_=t.useCallback(e=>{const r=o.current[e.searchQuery];C({eventName:"search_query_response_received",properties:{searchQuery:e.searchQuery,totalResults:r?.length}})},[]),j=t.useCallback(e=>{if(g.current&&window.clearTimeout(g.current),!e.searchQuery){f([]),h(null);return}g.current=window.setTimeout(()=>{C({eventName:"search_query_submitted",properties:{searchQuery:e.searchQuery}}),o.current[e.searchQuery]?(f(o.current[e.searchQuery]),_(e)):U(e).then(()=>{_(e)})},q)},[q,U]),p=t.useMemo(()=>({searchQuery:c,filters:{limit:R}}),[c,R]);t.useEffect(()=>{B?.(p.searchQuery),j(p)},[j,p]);const W=t.useCallback(e=>T(e.target.value),[]),G=t.useMemo(()=>Q||(b?"Search...":"Search for anything..."),[Q,b]);return{results:s,resultsList:d,hasContent:d.length>0||v,loading:v,error:H,query:c,onInput:W,placeholder:G,tab:y,onTabChange:K,selectedItem:$,setSelectedItem:a,onSelectedItemChange:z,transitionsDisabled:D,inputRef:k,isMobile:b}};exports.useInkeepSearch=se;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),X=require("../../providers/config-provider.cjs"),Y=require("../../hooks/use-media-query.cjs"),Z=require("./search-query.graphql.cjs"),ee=require("./transform-results.cjs"),te=require("../../providers/search-events-provider.cjs"),se=require("../../hooks/use-instant-update.cjs"),re=require("../../utils/graphql-client.cjs"),ne=()=>{const{baseSettings:N,searchSettings:O}=X.useInkeepConfig(),{apiKey:S,aiApiBaseUrl:x,userAuthToken:l,filters:R}=N,{maxResults:Q,placeholder:q,defaultQuery:B,debounceTimeMs:C,onQueryChange:H,searchFunctionsRef:$,tabs:i,filters:T}=O,{logEvent:k}=te.useSearchEvents(),[c,v]=t.useState(B),E=t.useRef(null),[M,w]=t.useState(!1),[z,h]=t.useState(null),[D,a]=t.useState("NONE"),K=t.useCallback(e=>{a(e)},[]),[f,d]=t.useState([]),s=ee.useTransformResults(f,c),I=typeof i?.[0]=="string"?i[0]:i[0][0],[y,A]=t.useState(I),{disableTransition:P,disabled:W}=se.useInstantUpdate(),G=t.useCallback(e=>{P(),A(e);const r=s[e][0].id;a(r)},[s,P]);t.useEffect(()=>{let e=y in s?y:Object.keys(s)[0];if(!s[e]?.length){const n=Object.keys(s).find(u=>s[u]?.length);n?e=n:e=I}if(!e)return;A(e);const r=s[e]?.[0];r&&a(r.id)},[s]);const b=Y.useMediaQuery("(max-width: 768px)"),o=t.useRef({}),m=t.useRef(null),g=t.useRef(null);t.useImperativeHandle($,()=>({updateQuery(e){v(e)},focusInput:()=>{E.current?.focus()}}));const U=`${x}/graphql`,_=t.useMemo(()=>({Authorization:`Bearer ${S}`,"Content-Type":"application/json",...l?{"User-Token":l}:{}}),[S,l]),j=t.useCallback(async e=>{m.current&&m.current.abort();const r=new AbortController;m.current=r;try{w(!0),h(null);const u=(await re.graphqlRequest(U,Z.default,{searchInput:e},_))?.search.searchHits;o.current[e.searchQuery]=u,d(u)}catch(n){if(n.name==="AbortError")return;h("Failed to fetch search results. Please try again.")}w(!1)},[U,_]),F=t.useCallback(e=>{const r=o.current[e.searchQuery];k({eventName:"search_query_response_received",properties:{searchQuery:e.searchQuery,totalResults:r?.length}})},[]),L=t.useCallback(e=>{if(g.current&&window.clearTimeout(g.current),!e.searchQuery){d([]),h(null);return}g.current=window.setTimeout(()=>{k({eventName:"search_query_submitted",properties:{searchQuery:e.searchQuery}}),o.current[e.searchQuery]?(d(o.current[e.searchQuery]),F(e)):j(e).then(()=>{F(e)})},C)},[C,j]),p=t.useMemo(()=>({searchQuery:c,filters:{...R,...T,limit:Q}}),[c,Q,R,T]);t.useEffect(()=>{H?.(p.searchQuery),L(p)},[L,p]);const J=t.useCallback(e=>v(e.target.value),[]),V=t.useMemo(()=>q||(b?"Search...":"Search for anything..."),[q,b]);return{results:s,resultsList:f,hasContent:f.length>0||M,loading:M,error:z,query:c,onInput:J,placeholder:V,tab:y,onTabChange:G,selectedItem:D,setSelectedItem:a,onSelectedItemChange:K,transitionsDisabled:W,inputRef:E,isMobile:b}};exports.useInkeepSearch=ne;
@@ -1,140 +1,143 @@
1
1
  "use client";
2
- import { useState as s, useRef as l, useCallback as n, useEffect as B, useImperativeHandle as Z, useMemo as T } from "react";
3
- import { useInkeepConfig as ee } from "../../providers/config-provider.js";
4
- import { useMediaQuery as te } from "../../hooks/use-media-query.js";
5
- import re from "./search-query.graphql.js";
6
- import { useTransformResults as se } from "./transform-results.js";
7
- import { useSearchEvents as ne } from "../../providers/search-events-provider.js";
8
- import { useInstantUpdate as oe } from "../../hooks/use-instant-update.js";
9
- import { graphqlRequest as ce } from "../../utils/graphql-client.js";
10
- const pe = () => {
11
- const { baseSettings: F, searchSettings: H } = ee(), { apiKey: S, aiApiBaseUrl: P, userAuthToken: h } = F, {
12
- maxResults: C,
13
- placeholder: v,
14
- defaultQuery: $,
15
- debounceTimeMs: k,
16
- onQueryChange: z,
17
- searchFunctionsRef: D,
18
- tabs: f
19
- } = H, { logEvent: w } = ne(), [c, q] = s($), E = l(null), [A, I] = s(!1), [K, m] = s(null), [W, a] = s("NONE"), G = n((e) => {
2
+ import { useState as s, useRef as l, useCallback as n, useEffect as H, useImperativeHandle as te, useMemo as T } from "react";
3
+ import { useInkeepConfig as re } from "../../providers/config-provider.js";
4
+ import { useMediaQuery as se } from "../../hooks/use-media-query.js";
5
+ import ne from "./search-query.graphql.js";
6
+ import { useTransformResults as oe } from "./transform-results.js";
7
+ import { useSearchEvents as ce } from "../../providers/search-events-provider.js";
8
+ import { useInstantUpdate as ae } from "../../hooks/use-instant-update.js";
9
+ import { graphqlRequest as ie } from "../../utils/graphql-client.js";
10
+ const be = () => {
11
+ const { baseSettings: P, searchSettings: $ } = re(), { apiKey: S, aiApiBaseUrl: z, userAuthToken: h, filters: C } = P, {
12
+ maxResults: v,
13
+ placeholder: k,
14
+ defaultQuery: D,
15
+ debounceTimeMs: w,
16
+ onQueryChange: K,
17
+ searchFunctionsRef: W,
18
+ tabs: f,
19
+ filters: q
20
+ } = $, { logEvent: E } = ce(), [c, A] = s(D), I = l(null), [_, x] = s(!1), [G, m] = s(null), [J, a] = s("NONE"), V = n((e) => {
20
21
  a(e);
21
- }, []), [d, p] = s([]), t = se(d, c), _ = typeof f?.[0] == "string" ? f[0] : f[0][0], [y, x] = s(_), { disableTransition: L, disabled: J } = oe(), V = n(
22
+ }, []), [d, p] = s([]), t = oe(d, c), F = typeof f?.[0] == "string" ? f[0] : f[0][0], [y, L] = s(F), { disableTransition: M, disabled: X } = ae(), Y = n(
22
23
  (e) => {
23
- L(), x(e);
24
+ M(), L(e);
24
25
  const r = t[e][0].id;
25
26
  a(r);
26
27
  },
27
- [t, L]
28
+ [t, M]
28
29
  );
29
- B(() => {
30
+ H(() => {
30
31
  let e = y in t ? y : Object.keys(t)[0];
31
32
  if (!t[e]?.length) {
32
- const o = Object.keys(t).find((i) => t[i]?.length);
33
- o ? e = o : e = _;
33
+ const o = Object.keys(t).find((u) => t[u]?.length);
34
+ o ? e = o : e = F;
34
35
  }
35
36
  if (!e) return;
36
- x(e);
37
+ L(e);
37
38
  const r = t[e]?.[0];
38
39
  r && a(r.id);
39
40
  }, [t]);
40
- const b = te("(max-width: 768px)"), u = l({}), g = l(null), Q = l(null);
41
- Z(D, () => ({
41
+ const b = se("(max-width: 768px)"), i = l({}), g = l(null), Q = l(null);
42
+ te(W, () => ({
42
43
  updateQuery(e) {
43
- q(e);
44
+ A(e);
44
45
  },
45
46
  focusInput: () => {
46
- E.current?.focus();
47
+ I.current?.focus();
47
48
  }
48
49
  }));
49
- const M = `${P}/graphql`, N = T(
50
+ const N = `${z}/graphql`, U = T(
50
51
  () => ({
51
52
  Authorization: `Bearer ${S}`,
52
53
  "Content-Type": "application/json",
53
54
  ...h ? { "User-Token": h } : {}
54
55
  }),
55
56
  [S, h]
56
- ), U = n(
57
+ ), j = n(
57
58
  async (e) => {
58
59
  g.current && g.current.abort();
59
60
  const r = new AbortController();
60
61
  g.current = r;
61
62
  try {
62
- I(!0), m(null);
63
- const i = (await ce(M, re, { searchInput: e }, N))?.search.searchHits;
64
- u.current[e.searchQuery] = i, p(i);
63
+ x(!0), m(null);
64
+ const u = (await ie(N, ne, { searchInput: e }, U))?.search.searchHits;
65
+ i.current[e.searchQuery] = u, p(u);
65
66
  } catch (o) {
66
67
  if (o.name === "AbortError")
67
68
  return;
68
69
  m("Failed to fetch search results. Please try again.");
69
70
  }
70
- I(!1);
71
+ x(!1);
71
72
  },
72
- [M, N]
73
- ), j = n((e) => {
74
- const r = u.current[e.searchQuery];
75
- w({
73
+ [N, U]
74
+ ), O = n((e) => {
75
+ const r = i.current[e.searchQuery];
76
+ E({
76
77
  eventName: "search_query_response_received",
77
78
  properties: {
78
79
  searchQuery: e.searchQuery,
79
80
  totalResults: r?.length
80
81
  }
81
82
  });
82
- }, []), O = n(
83
+ }, []), B = n(
83
84
  (e) => {
84
85
  if (Q.current && window.clearTimeout(Q.current), !e.searchQuery) {
85
86
  p([]), m(null);
86
87
  return;
87
88
  }
88
89
  Q.current = window.setTimeout(() => {
89
- w({
90
+ E({
90
91
  eventName: "search_query_submitted",
91
92
  properties: {
92
93
  searchQuery: e.searchQuery
93
94
  }
94
- }), u.current[e.searchQuery] ? (p(u.current[e.searchQuery]), j(e)) : U(e).then(() => {
95
- j(e);
95
+ }), i.current[e.searchQuery] ? (p(i.current[e.searchQuery]), O(e)) : j(e).then(() => {
96
+ O(e);
96
97
  });
97
- }, k);
98
+ }, w);
98
99
  },
99
- [k, U]
100
+ [w, j]
100
101
  ), R = T(
101
102
  () => ({
102
103
  searchQuery: c,
103
104
  filters: {
104
- limit: C
105
+ ...C,
106
+ ...q,
107
+ limit: v
105
108
  }
106
109
  }),
107
- [c, C]
110
+ [c, v, C, q]
108
111
  );
109
- B(() => {
110
- z?.(R.searchQuery), O(R);
111
- }, [O, R]);
112
- const X = n(
113
- (e) => q(e.target.value),
112
+ H(() => {
113
+ K?.(R.searchQuery), B(R);
114
+ }, [B, R]);
115
+ const Z = n(
116
+ (e) => A(e.target.value),
114
117
  []
115
- ), Y = T(
116
- () => v || (b ? "Search..." : "Search for anything..."),
117
- [v, b]
118
+ ), ee = T(
119
+ () => k || (b ? "Search..." : "Search for anything..."),
120
+ [k, b]
118
121
  );
119
122
  return {
120
123
  results: t,
121
124
  resultsList: d,
122
- hasContent: d.length > 0 || A,
123
- loading: A,
124
- error: K,
125
+ hasContent: d.length > 0 || _,
126
+ loading: _,
127
+ error: G,
125
128
  query: c,
126
- onInput: X,
127
- placeholder: Y,
129
+ onInput: Z,
130
+ placeholder: ee,
128
131
  tab: y,
129
- onTabChange: V,
130
- selectedItem: W,
132
+ onTabChange: Y,
133
+ selectedItem: J,
131
134
  setSelectedItem: a,
132
- onSelectedItemChange: G,
133
- transitionsDisabled: J,
134
- inputRef: E,
135
+ onSelectedItemChange: V,
136
+ transitionsDisabled: X,
137
+ inputRef: I,
135
138
  isMobile: b
136
139
  };
137
140
  };
138
141
  export {
139
- pe as useInkeepSearch
142
+ be as useInkeepSearch
140
143
  };
package/dist/index.d.cts CHANGED
@@ -737,6 +737,8 @@ export declare const componentIDs: {
737
737
  markdownCode: "markdownCode";
738
738
  };
739
739
 
740
+ declare type ComponentProps = Omit<ComponentPropsWithRef<typeof PrimitiveChatHelpAction>, 'action'> | ComponentPropsWithRef<typeof PrimitiveChatHelpActionLink>;
741
+
740
742
  export declare function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T | null) => void;
741
743
 
742
744
  export declare interface ContainerSize {
@@ -1634,9 +1636,9 @@ declare type EmbeddedChatPrimitiveChatActionType = 'help' | 'copy' | 'share' | '
1634
1636
 
1635
1637
  declare const EmbeddedChatPrimitiveChatHelpAction: (props: EmbeddedChatPrimitiveChatHelpActionProps) => JSX.Element;
1636
1638
 
1637
- declare interface EmbeddedChatPrimitiveChatHelpActionProps extends Omit<ComponentPropsWithRef<typeof PrimitiveChatHelpAction>, 'action'> {
1639
+ declare type EmbeddedChatPrimitiveChatHelpActionProps = ComponentProps & {
1638
1640
  action: GetHelpOption;
1639
- }
1641
+ };
1640
1642
 
1641
1643
  declare const EmbeddedChatPrimitiveContent: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
1642
1644
 
@@ -2893,6 +2895,8 @@ declare const PrimitiveChatButtonAvatarImage: ForwardRefExoticComponent< Polymor
2893
2895
 
2894
2896
  declare const PrimitiveChatHelpAction: ForwardRefExoticComponent< PolymorphicProps & Omit<EmbeddedChatPrimitiveChatActionProps, "action" | "_id"> & Partial<Pick<EmbeddedChatPrimitiveChatActionProps, "action" | "_id">>>;
2895
2897
 
2898
+ declare const PrimitiveChatHelpActionLink: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "rel" | "target" | "_id"> & Partial<Pick< DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "rel" | "target" | "_id">>>;
2899
+
2896
2900
  declare const PrimitiveConfidentAnswer: ForwardRefExoticComponent< PolymorphicProps & Omit< ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & MarkdownProps, "_id"> & Partial<Pick< ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & MarkdownProps, "_id">>>;
2897
2901
 
2898
2902
  declare const PrimitiveConfidentResponseButton: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "type" | "_id"> & Partial<Pick< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "type" | "_id">>>;
package/dist/index.d.ts CHANGED
@@ -737,6 +737,8 @@ export declare const componentIDs: {
737
737
  markdownCode: "markdownCode";
738
738
  };
739
739
 
740
+ declare type ComponentProps = Omit<ComponentPropsWithRef<typeof PrimitiveChatHelpAction>, 'action'> | ComponentPropsWithRef<typeof PrimitiveChatHelpActionLink>;
741
+
740
742
  export declare function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T | null) => void;
741
743
 
742
744
  export declare interface ContainerSize {
@@ -1634,9 +1636,9 @@ declare type EmbeddedChatPrimitiveChatActionType = 'help' | 'copy' | 'share' | '
1634
1636
 
1635
1637
  declare const EmbeddedChatPrimitiveChatHelpAction: (props: EmbeddedChatPrimitiveChatHelpActionProps) => JSX.Element;
1636
1638
 
1637
- declare interface EmbeddedChatPrimitiveChatHelpActionProps extends Omit<ComponentPropsWithRef<typeof PrimitiveChatHelpAction>, 'action'> {
1639
+ declare type EmbeddedChatPrimitiveChatHelpActionProps = ComponentProps & {
1638
1640
  action: GetHelpOption;
1639
- }
1641
+ };
1640
1642
 
1641
1643
  declare const EmbeddedChatPrimitiveContent: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
1642
1644
 
@@ -2893,6 +2895,8 @@ declare const PrimitiveChatButtonAvatarImage: ForwardRefExoticComponent< Polymor
2893
2895
 
2894
2896
  declare const PrimitiveChatHelpAction: ForwardRefExoticComponent< PolymorphicProps & Omit<EmbeddedChatPrimitiveChatActionProps, "action" | "_id"> & Partial<Pick<EmbeddedChatPrimitiveChatActionProps, "action" | "_id">>>;
2895
2897
 
2898
+ declare const PrimitiveChatHelpActionLink: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "rel" | "target" | "_id"> & Partial<Pick< DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "rel" | "target" | "_id">>>;
2899
+
2896
2900
  declare const PrimitiveConfidentAnswer: ForwardRefExoticComponent< PolymorphicProps & Omit< ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & MarkdownProps, "_id"> & Partial<Pick< ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & MarkdownProps, "_id">>>;
2897
2901
 
2898
2902
  declare const PrimitiveConfidentResponseButton: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "type" | "_id"> & Partial<Pick< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "type" | "_id">>>;
@@ -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.23",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;
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.25",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.23",
10
+ widgetLibraryVersion: "0.5.25",
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.23",
3
+ "version": "0.5.25",
4
4
  "description": "",
5
5
  "license": "Inkeep, Inc. Customer License (IICL) v1.1",
6
6
  "homepage": "",
@@ -58,9 +58,9 @@
58
58
  "rehype-raw": "7.0.0",
59
59
  "unist-util-visit": "^5.0.0",
60
60
  "use-sync-external-store": "^1.4.0",
61
- "@inkeep/cxkit-color-mode": "0.5.23",
62
- "@inkeep/cxkit-theme": "0.5.23",
63
- "@inkeep/cxkit-types": "0.5.23"
61
+ "@inkeep/cxkit-color-mode": "0.5.25",
62
+ "@inkeep/cxkit-theme": "0.5.25",
63
+ "@inkeep/cxkit-types": "0.5.25"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@biomejs/biome": "1.9.4",