@inkeep/cxkit-primitives 0.5.99 → 0.5.100

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 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.100",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.100",
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.100",
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.100",
71
+ "@inkeep/cxkit-theme": "0.5.100",
72
+ "@inkeep/cxkit-types": "0.5.100"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@biomejs/biome": "1.9.4",