@inkeep/cxkit-primitives 0.5.99 → 0.5.101

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("../../atoms/cmdk/index.cjs"),L=require("../../providers/search-events-provider.cjs"),P=require("../../providers/config-provider.cjs"),U=require("../../utils/graphql-client.cjs"),B=require("./search-query.graphql.cjs"),H=require("./search-provider.cjs"),O=400,j=()=>{const{setResultsList:o,setLoading:u,showSearchResults:a,setShowSearchResults:i}=H.useSearch(),{baseSettings:_,searchSettings:k}=P.useInkeepConfig(),{apiKey:y,aiApiBaseUrl:A,userAuthToken:l,filters:R}=_,{maxResults:m,debounceTimeMs:S,onQueryChange:M,filters:b}=k,{logEvent:g}=L.useSearchEvents(),s=r.useRef({}),h=r.useRef(null),f=r.useRef(null),T=`${A}/graphql`,q=r.useMemo(()=>({Authorization:`Bearer ${y}`,"Content-Type":"application/json",...l?{"User-Token":l}:{}}),[y,l]),w=r.useCallback(async e=>{const t=new AbortController;h.current=t;try{const E=(await U.graphqlRequest(T,B.default,{searchInput:e},q,t.signal))?.search.searchHits;s.current[e.searchQuery]=E,o(E)}catch(C){if(C.name==="AbortError")return}finally{u(!1)}},[T,q]),Q=r.useCallback(e=>{const t=s.current[e.searchQuery];g({eventName:"search_query_response_received",properties:{searchQuery:e.searchQuery,totalResults:t?.length}})},[]),p=()=>{h.current&&(h.current.abort(),u(!1))},v=r.useCallback(e=>{if(f.current&&window.clearTimeout(f.current),!e.searchQuery){p(),o([]);return}f.current=window.setTimeout(()=>{p(),g({eventName:"search_query_submitted",properties:{searchQuery:e.searchQuery}}),s.current[e.searchQuery]?(o(s.current[e.searchQuery]),Q(e)):(u(!0),w(e).then(()=>{Q(e)}))},S)},[S,w]),c=F.useCommandState(e=>e.search),d=r.useMemo(()=>({searchQuery:c,filters:{...R,...b,limit:m}}),[c,m,R,b]),n=r.useRef(null);r.useEffect(()=>{const e=()=>{n.current!==null&&(window.clearTimeout(n.current),n.current=null)},t=!!c;return t&&!a?(e(),n.current=window.setTimeout(()=>{i(!0)},O)):!t&&a&&(e(),i(!1)),e},[c,a,i]),r.useEffect(()=>{M?.(d.searchQuery),v(d)},[v,d])};exports.useSearchFetch=j;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),F=require("../../atoms/cmdk/index.cjs"),L=require("../../providers/search-events-provider.cjs"),P=require("../../providers/config-provider.cjs"),U=require("../../utils/graphql-client.cjs"),B=require("./search-query.graphql.cjs"),H=require("./search-provider.cjs"),O=250,j=()=>{const{setResultsList:o,setLoading:u,showSearchResults:a,setShowSearchResults:i}=H.useSearch(),{baseSettings:_,searchSettings:k}=P.useInkeepConfig(),{apiKey:y,aiApiBaseUrl:A,userAuthToken:l,filters:R}=_,{maxResults:m,debounceTimeMs:S,onQueryChange:M,filters:b}=k,{logEvent:g}=L.useSearchEvents(),s=r.useRef({}),h=r.useRef(null),f=r.useRef(null),T=`${A}/graphql`,q=r.useMemo(()=>({Authorization:`Bearer ${y}`,"Content-Type":"application/json",...l?{"User-Token":l}:{}}),[y,l]),w=r.useCallback(async e=>{const t=new AbortController;h.current=t;try{const E=(await U.graphqlRequest(T,B.default,{searchInput:e},q,t.signal))?.search.searchHits;s.current[e.searchQuery]=E,o(E)}catch(C){if(C.name==="AbortError")return}finally{u(!1)}},[T,q]),Q=r.useCallback(e=>{const t=s.current[e.searchQuery];g({eventName:"search_query_response_received",properties:{searchQuery:e.searchQuery,totalResults:t?.length}})},[]),p=()=>{h.current&&(h.current.abort(),u(!1))},v=r.useCallback(e=>{if(f.current&&window.clearTimeout(f.current),!e.searchQuery){p(),o([]);return}f.current=window.setTimeout(()=>{p(),g({eventName:"search_query_submitted",properties:{searchQuery:e.searchQuery}}),s.current[e.searchQuery]?(o(s.current[e.searchQuery]),Q(e)):(u(!0),w(e).then(()=>{Q(e)}))},S)},[S,w]),c=F.useCommandState(e=>e.search),d=r.useMemo(()=>({searchQuery:c,filters:{...R,...b,limit:m}}),[c,m,R,b]),n=r.useRef(null);r.useEffect(()=>{const e=()=>{n.current!==null&&(window.clearTimeout(n.current),n.current=null)},t=!!c;return t&&!a?(e(),n.current=window.setTimeout(()=>{i(!0)},O)):!t&&a&&(e(),i(!1)),e},[c,a,i]),r.useEffect(()=>{M?.(d.searchQuery),v(d)},[v,d])};exports.useSearchFetch=j;
@@ -6,7 +6,7 @@ import { useInkeepConfig as x } from "../../providers/config-provider.js";
6
6
  import { graphqlRequest as N } from "../../utils/graphql-client.js";
7
7
  import O from "./search-query.graphql.js";
8
8
  import { useSearch as $ } from "./search-provider.js";
9
- const j = 400, V = () => {
9
+ const j = 250, V = () => {
10
10
  const { setResultsList: c, setLoading: u, showSearchResults: a, setShowSearchResults: i } = $(), { baseSettings: L, searchSettings: U } = x(), { apiKey: R, aiApiBaseUrl: B, userAuthToken: l, filters: d } = L, { maxResults: p, debounceTimeMs: S, onQueryChange: F, filters: w } = U, { logEvent: T } = M(), t = n({}), h = n(null), m = n(null), Q = `${B}/graphql`, b = A(
11
11
  () => ({
12
12
  Authorization: `Bearer ${R}`,
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("openai"),t=require("react"),J=require("react-hook-form"),W=require("../../utils/form.cjs"),X=require("./actions/qa-model-response.cjs"),z=require("./actions/context-model-response.cjs"),Y=require("../../providers/config-provider.cjs"),Z=require("../../providers/conversation-provider.cjs"),ee=require("../../providers/chat-events-provider.cjs"),se=require("./actions/qa-model-messages.cjs"),re=require("../embedded-chat/use-captcha.cjs"),te="root.serverError",_=async(l,s)=>{if(s)return;const o=await re.fetchAndSolveChallenge(`${l}/v1/challenge`);if(o)return{"X-INKEEP-CHALLENGE-SOLUTION":btoa(JSON.stringify(o))}},oe=l=>{const{formSettings:s}=l,{baseSettings:o}=Y.useInkeepConfig(),{conversation:y}=Z.useInkeepConversation(),{logEvent:u}=ee.useChatEvents(),{aiApiBaseUrl:a,shouldBypassCaptcha:S}=o,w=t.useMemo(()=>new $({baseURL:`${a}/v1`,apiKey:o.apiKey,dangerouslyAllowBrowser:!0}),[o.apiKey,a]),[q,h]=t.useState(!1),[M,V]=t.useState(!1),[A,m]=t.useState(!1),[F,v]=t.useState({}),c=t.useMemo(()=>{const{primary:n,secondary:i}=s;return W.getFormDefaultValues([...n.fields,...i.fields])},[s]),{control:b,handleSubmit:I,formState:{errors:C,isSubmitting:P,isSubmitSuccessful:N},reset:E,trigger:O,setValue:k,setError:H}=J.useForm({defaultValues:c});t.useEffect(()=>{c&&E(c)},[E,c]);const L=async n=>{try{await s.buttons.submit.onSubmit({values:n,conversation:y}),u({eventName:"intelligent_form_submitted",properties:{conversation:y,values:n}})}catch(i){H(te,{message:i instanceof Error?i.message:"Something went wrong."})}},x=async()=>{const n=s.primary.fields.map(e=>e.name);if(!await O(n))return;V(!0),h(!0);const T=b._formValues,R=s.primary.fields.reduce((e,d)=>(e[d.name]=T[d.name],e),{}),U=s.secondary.fields.filter(e=>e.shouldPrefillWithAI!==!1),f=se.getQAModelMessages(R);u({eventName:"intelligent_form_primary_section_submitted",properties:{}},f);try{const e=await _(a,S),d=await _(a,S),[r,g]=await Promise.all([X.generateQAModelResponse(f,w,e),z.generateContextModelResponse({primaryFieldValues:R,fieldsToGenerate:U},w,d)]);if(g.suggestedValues)for(const[G,Q]of Object.entries(g.suggestedValues))k(G,Q);const p=r.aiAnnotations?.answerConfidence,j=p&&["very_confident","somewhat_confident"].includes(p),D=r.recordsConsidered&&r.recordsConsidered.length>0;j&&D&&r.answer?(v({answer:r.answer,answerConfidence:p,recordsConsidered:r.recordsConsidered}),u({eventName:"intelligent_form_ai_response_provided",properties:{recordsConsidered:r.recordsConsidered}},[...f,{id:Date.now().toString(),role:"assistant",content:r.answer,links:[]}])):(m(!0),v({answer:null,recordsConsidered:r.recordsConsidered,suggestedValues:g.suggestedValues}))}catch(e){console.error(e),m(!0)}finally{h(!1)}},K=I(L),B=C?.root?.serverError;return{formSettings:s,control:b,errors:C,isSubmitSuccessful:N,isSubmitting:P,handleSubmit:K,loading:q,formError:B,submittedPrimaryForm:M,handleSubmitPrimaryForm:x,aiResponse:F,showSecondaryFields:A,setShowSecondaryFields:m}};exports.useInkeepIntelligentForm=oe;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("openai"),t=require("react"),J=require("react-hook-form"),W=require("../../utils/form.cjs"),X=require("./actions/qa-model-response.cjs"),z=require("./actions/context-model-response.cjs"),Y=require("../../providers/config-provider.cjs"),Z=require("../../providers/conversation-provider.cjs"),ee=require("../../providers/chat-events-provider.cjs"),se=require("./actions/qa-model-messages.cjs"),re=require("../embedded-chat/use-captcha.cjs"),te="root.serverError",R=async(u,s)=>{if(s)return;const o=await re.fetchAndSolveChallenge(`${u}/v1/challenge`);if(o)return{"X-INKEEP-CHALLENGE-SOLUTION":btoa(JSON.stringify(o))}},oe=u=>{const{formSettings:s}=u,{baseSettings:o}=Y.useInkeepConfig(),{conversation:m}=Z.useInkeepConversation(),{logEvent:a}=ee.useChatEvents(),{aiApiBaseUrl:c,shouldBypassCaptcha:S}=o,v=t.useMemo(()=>new $({baseURL:`${c}/v1`,apiKey:o.apiKey,dangerouslyAllowBrowser:!0}),[o.apiKey,c]),[q,w]=t.useState(!1),[M,V]=t.useState(!1),[A,f]=t.useState(!1),[F,h]=t.useState({}),d=t.useMemo(()=>{const{primary:n,secondary:i}=s;return W.getFormDefaultValues([...n.fields,...i.fields])},[s]),{control:b,handleSubmit:I,formState:{errors:C,isSubmitting:N,isSubmitSuccessful:P},reset:_,trigger:O,setValue:k,setError:H}=J.useForm({defaultValues:d});t.useEffect(()=>{d&&_(d)},[_,d]);const L=async n=>{try{await s.buttons.submit.onSubmit({values:n,conversation:m}),a({eventName:"intelligent_form_submitted",properties:{conversation:m,values:n}}),a({eventName:"user_escalation_indicated",properties:{escalationType:"intelligent_support_form",conversation:m}})}catch(i){H(te,{message:i instanceof Error?i.message:"Something went wrong."})}},x=async()=>{const n=s.primary.fields.map(e=>e.name);if(!await O(n))return;V(!0),w(!0);const B=b._formValues,E=s.primary.fields.reduce((e,l)=>(e[l.name]=B[l.name],e),{}),U=s.secondary.fields.filter(e=>e.shouldPrefillWithAI!==!1),g=se.getQAModelMessages(E);a({eventName:"intelligent_form_primary_section_submitted",properties:{}},g);try{const e=await R(c,S),l=await R(c,S),[r,p]=await Promise.all([X.generateQAModelResponse(g,v,e),z.generateContextModelResponse({primaryFieldValues:E,fieldsToGenerate:U},v,l)]);if(p.suggestedValues)for(const[G,Q]of Object.entries(p.suggestedValues))k(G,Q);const y=r.aiAnnotations?.answerConfidence,j=y&&["very_confident","somewhat_confident"].includes(y),D=r.recordsConsidered&&r.recordsConsidered.length>0;j&&D&&r.answer?(h({answer:r.answer,answerConfidence:y,recordsConsidered:r.recordsConsidered}),a({eventName:"intelligent_form_ai_response_provided",properties:{recordsConsidered:r.recordsConsidered}},[...g,{id:Date.now().toString(),role:"assistant",content:r.answer,links:[]}])):(f(!0),h({answer:null,recordsConsidered:r.recordsConsidered,suggestedValues:p.suggestedValues}))}catch(e){console.error(e),f(!0)}finally{w(!1)}},K=I(L),T=C?.root?.serverError;return{formSettings:s,control:b,errors:C,isSubmitSuccessful:P,isSubmitting:N,handleSubmit:K,loading:q,formError:T,submittedPrimaryForm:M,handleSubmitPrimaryForm:x,aiResponse:F,showSecondaryFields:A,setShowSecondaryFields:f}};exports.useInkeepIntelligentForm=oe;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import J from "openai";
3
- import { useMemo as R, useState as l, useEffect as W } from "react";
3
+ import { useMemo as R, useState as c, useEffect as W } from "react";
4
4
  import { useForm as X } from "react-hook-form";
5
5
  import { getFormDefaultValues as z } from "../../utils/form.js";
6
6
  import { generateQAModelResponse as Y } from "./actions/qa-model-response.js";
@@ -8,50 +8,56 @@ import { generateContextModelResponse as Z } from "./actions/context-model-respo
8
8
  import { useInkeepConfig as ee } from "../../providers/config-provider.js";
9
9
  import { useInkeepConversation as se } from "../../providers/conversation-provider.js";
10
10
  import { useChatEvents as re } from "../../providers/chat-events-provider.js";
11
- import { getQAModelMessages as oe } from "./actions/qa-model-messages.js";
12
- import { fetchAndSolveChallenge as te } from "../embedded-chat/use-captcha.js";
13
- const ne = "root.serverError", V = async (c, s) => {
11
+ import { getQAModelMessages as te } from "./actions/qa-model-messages.js";
12
+ import { fetchAndSolveChallenge as oe } from "../embedded-chat/use-captcha.js";
13
+ const ne = "root.serverError", V = async (m, s) => {
14
14
  if (s) return;
15
- const o = await te(`${c}/v1/challenge`);
16
- if (o)
15
+ const t = await oe(`${m}/v1/challenge`);
16
+ if (t)
17
17
  return {
18
- "X-INKEEP-CHALLENGE-SOLUTION": btoa(JSON.stringify(o))
18
+ "X-INKEEP-CHALLENGE-SOLUTION": btoa(JSON.stringify(t))
19
19
  };
20
- }, we = (c) => {
21
- const { formSettings: s } = c, { baseSettings: o } = ee(), { conversation: y } = se(), { logEvent: m } = re(), { aiApiBaseUrl: i, shouldBypassCaptcha: w } = o, S = R(
20
+ }, we = (m) => {
21
+ const { formSettings: s } = m, { baseSettings: t } = ee(), { conversation: u } = se(), { logEvent: i } = re(), { aiApiBaseUrl: a, shouldBypassCaptcha: w } = t, S = R(
22
22
  () => new J({
23
- baseURL: `${i}/v1`,
24
- apiKey: o.apiKey,
23
+ baseURL: `${a}/v1`,
24
+ apiKey: t.apiKey,
25
25
  dangerouslyAllowBrowser: !0
26
26
  }),
27
- [o.apiKey, i]
28
- ), [A, h] = l(!1), [F, I] = l(!1), [N, u] = l(!1), [M, C] = l({}), a = R(() => {
29
- const { primary: t, secondary: n } = s;
30
- return z([...t.fields, ...n.fields]);
27
+ [t.apiKey, a]
28
+ ), [A, h] = c(!1), [F, N] = c(!1), [I, f] = c(!1), [M, _] = c({}), d = R(() => {
29
+ const { primary: o, secondary: n } = s;
30
+ return z([...o.fields, ...n.fields]);
31
31
  }, [s]), {
32
- control: b,
32
+ control: C,
33
33
  handleSubmit: O,
34
- formState: { errors: v, isSubmitting: P, isSubmitSuccessful: L },
35
- reset: E,
34
+ formState: { errors: b, isSubmitting: P, isSubmitSuccessful: L },
35
+ reset: v,
36
36
  trigger: k,
37
37
  setValue: x,
38
38
  setError: H
39
39
  } = X({
40
- defaultValues: a
40
+ defaultValues: d
41
41
  });
42
42
  W(() => {
43
- a && E(a);
44
- }, [E, a]);
45
- const K = async (t) => {
43
+ d && v(d);
44
+ }, [v, d]);
45
+ const K = async (o) => {
46
46
  try {
47
47
  await s.buttons.submit.onSubmit({
48
- values: t,
49
- conversation: y
50
- }), m({
48
+ values: o,
49
+ conversation: u
50
+ }), i({
51
51
  eventName: "intelligent_form_submitted",
52
52
  properties: {
53
- conversation: y,
54
- values: t
53
+ conversation: u,
54
+ values: o
55
+ }
56
+ }), i({
57
+ eventName: "user_escalation_indicated",
58
+ properties: {
59
+ escalationType: "intelligent_support_form",
60
+ conversation: u
55
61
  }
56
62
  });
57
63
  } catch (n) {
@@ -60,40 +66,40 @@ const ne = "root.serverError", V = async (c, s) => {
60
66
  });
61
67
  }
62
68
  }, B = async () => {
63
- const t = s.primary.fields.map((e) => e.name);
64
- if (!await k(t)) return;
65
- I(!0), h(!0);
66
- const D = b._formValues, _ = s.primary.fields.reduce(
67
- (e, d) => (e[d.name] = D[d.name], e),
69
+ const o = s.primary.fields.map((e) => e.name);
70
+ if (!await k(o)) return;
71
+ N(!0), h(!0);
72
+ const q = C._formValues, E = s.primary.fields.reduce(
73
+ (e, l) => (e[l.name] = q[l.name], e),
68
74
  {}
69
- ), G = s.secondary.fields.filter(
75
+ ), D = s.secondary.fields.filter(
70
76
  (e) => e.shouldPrefillWithAI !== !1
71
- ), f = oe(_);
72
- m(
77
+ ), p = te(E);
78
+ i(
73
79
  {
74
80
  eventName: "intelligent_form_primary_section_submitted",
75
81
  properties: {}
76
82
  },
77
- f
83
+ p
78
84
  );
79
85
  try {
80
- const e = await V(i, w), d = await V(i, w), [r, p] = await Promise.all([
81
- Y(f, S, e),
86
+ const e = await V(a, w), l = await V(a, w), [r, g] = await Promise.all([
87
+ Y(p, S, e),
82
88
  Z(
83
- { primaryFieldValues: _, fieldsToGenerate: G },
89
+ { primaryFieldValues: E, fieldsToGenerate: D },
84
90
  S,
85
- d
91
+ l
86
92
  )
87
93
  ]);
88
- if (p.suggestedValues)
89
- for (const [$, j] of Object.entries(p.suggestedValues))
94
+ if (g.suggestedValues)
95
+ for (const [$, j] of Object.entries(g.suggestedValues))
90
96
  x($, j);
91
- const g = r.aiAnnotations?.answerConfidence, Q = g && ["very_confident", "somewhat_confident"].includes(g), T = r.recordsConsidered && r.recordsConsidered.length > 0;
92
- Q && T && r.answer ? (C({
97
+ const y = r.aiAnnotations?.answerConfidence, G = y && ["very_confident", "somewhat_confident"].includes(y), Q = r.recordsConsidered && r.recordsConsidered.length > 0;
98
+ G && Q && r.answer ? (_({
93
99
  answer: r.answer,
94
- answerConfidence: g,
100
+ answerConfidence: y,
95
101
  recordsConsidered: r.recordsConsidered
96
- }), m(
102
+ }), i(
97
103
  {
98
104
  eventName: "intelligent_form_ai_response_provided",
99
105
  properties: {
@@ -101,34 +107,34 @@ const ne = "root.serverError", V = async (c, s) => {
101
107
  }
102
108
  },
103
109
  [
104
- ...f,
110
+ ...p,
105
111
  { id: Date.now().toString(), role: "assistant", content: r.answer, links: [] }
106
112
  ]
107
- )) : (u(!0), C({
113
+ )) : (f(!0), _({
108
114
  answer: null,
109
115
  recordsConsidered: r.recordsConsidered,
110
- suggestedValues: p.suggestedValues
116
+ suggestedValues: g.suggestedValues
111
117
  }));
112
118
  } catch (e) {
113
- console.error(e), u(!0);
119
+ console.error(e), f(!0);
114
120
  } finally {
115
121
  h(!1);
116
122
  }
117
- }, U = O(K), q = v?.root?.serverError;
123
+ }, T = O(K), U = b?.root?.serverError;
118
124
  return {
119
125
  formSettings: s,
120
- control: b,
121
- errors: v,
126
+ control: C,
127
+ errors: b,
122
128
  isSubmitSuccessful: L,
123
129
  isSubmitting: P,
124
- handleSubmit: U,
130
+ handleSubmit: T,
125
131
  loading: A,
126
- formError: q,
132
+ formError: U,
127
133
  submittedPrimaryForm: F,
128
134
  handleSubmitPrimaryForm: B,
129
135
  aiResponse: M,
130
- showSecondaryFields: N,
131
- setShowSecondaryFields: u
136
+ showSecondaryFields: I,
137
+ setShowSecondaryFields: f
132
138
  };
133
139
  };
134
140
  export {
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react/jsx-runtime"),t=require("react"),f=require("../atoms/api/analytics/events.cjs"),b=require("./config-provider.cjs"),x=require("./user-provider.cjs"),E=t.createContext(void 0),q=({children:e})=>{const{baseSettings:s,componentType:r}=b.useInkeepConfig(),{apiKey:i,analyticsApiBaseUrl:c,tags:a,privacyPreferences:m,env:g,analyticsProperties:v}=s,{userProperties:u}=x.useUser(),l=t.useMemo(()=>({widgetLibraryVersion:"0.5.99",componentType:r,tags:a}),[r,a]),d=!m.optOutAllAnalytics&&g!=="development",P={logEvent:t.useCallback(async n=>{const o={...l,...n.properties,...v},p={eventName:n.eventName,properties:o,userProperties:u},y=["modal_opened","modal_closed"].includes(n.eventName);if(d&&!y){if("conversation"in o&&!o.conversation?.id)return;f.logEvent(p,i,c)}s.onEvent?.(p)},[d,s,i,c,u,l,v])};return B.jsx(E.Provider,{value:P,children:e})},C=()=>{const e=t.useContext(E);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=q;exports.useBaseEvents=C;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react/jsx-runtime"),t=require("react"),f=require("../atoms/api/analytics/events.cjs"),b=require("./config-provider.cjs"),x=require("./user-provider.cjs"),E=t.createContext(void 0),q=({children:e})=>{const{baseSettings:s,componentType:r}=b.useInkeepConfig(),{apiKey:i,analyticsApiBaseUrl:c,tags:a,privacyPreferences:m,env:g,analyticsProperties:v}=s,{userProperties:u}=x.useUser(),l=t.useMemo(()=>({widgetLibraryVersion:"0.5.101",componentType:r,tags:a}),[r,a]),d=!m.optOutAllAnalytics&&g!=="development",P={logEvent:t.useCallback(async n=>{const o={...l,...n.properties,...v},p={eventName:n.eventName,properties:o,userProperties:u},y=["modal_opened","modal_closed"].includes(n.eventName);if(d&&!y){if("conversation"in o&&!o.conversation?.id)return;f.logEvent(p,i,c)}s.onEvent?.(p)},[d,s,i,c,u,l,v])};return B.jsx(E.Provider,{value:P,children:e})},C=()=>{const e=t.useContext(E);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=q;exports.useBaseEvents=C;
@@ -7,7 +7,7 @@ import { useUser as A } from "./user-provider.js";
7
7
  const u = B(void 0), $ = ({ children: e }) => {
8
8
  const { baseSettings: t, componentType: s } = w(), { apiKey: r, analyticsApiBaseUrl: i, tags: a, privacyPreferences: d, env: E, analyticsProperties: c } = t, { userProperties: v } = A(), p = P(
9
9
  () => ({
10
- widgetLibraryVersion: "0.5.99",
10
+ widgetLibraryVersion: "0.5.101",
11
11
  componentType: s,
12
12
  tags: a
13
13
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/cxkit-primitives",
3
- "version": "0.5.99",
3
+ "version": "0.5.101",
4
4
  "description": "",
5
5
  "license": "Inkeep, Inc. Customer License (IICL) v1.1",
6
6
  "homepage": "",
@@ -67,9 +67,9 @@
67
67
  "remark-gfm": "^4.0.1",
68
68
  "unist-util-visit": "^5.0.0",
69
69
  "use-sync-external-store": "^1.4.0",
70
- "@inkeep/cxkit-color-mode": "^0.5.99",
71
- "@inkeep/cxkit-theme": "0.5.99",
72
- "@inkeep/cxkit-types": "0.5.99"
70
+ "@inkeep/cxkit-color-mode": "^0.5.101",
71
+ "@inkeep/cxkit-theme": "0.5.101",
72
+ "@inkeep/cxkit-types": "0.5.101"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@biomejs/biome": "1.9.4",