@inkeep/cxkit-primitives 0.5.6 → 0.5.9

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.
Files changed (54) hide show
  1. package/dist/atoms/api/analytics/events.cjs +1 -1
  2. package/dist/atoms/api/analytics/events.js +2 -2
  3. package/dist/components/embedded-chat/use-chat-action.cjs +1 -1
  4. package/dist/components/embedded-chat/use-chat-action.js +14 -16
  5. package/dist/components/embedded-chat/use-inkeep-chat.cjs +3 -3
  6. package/dist/components/embedded-chat/use-inkeep-chat.js +117 -123
  7. package/dist/components/embedded-chat.cjs +5 -5
  8. package/dist/components/embedded-chat.d.cts +9 -8
  9. package/dist/components/embedded-chat.d.ts +9 -8
  10. package/dist/components/embedded-chat.js +952 -963
  11. package/dist/components/embedded-search/use-inkeep-search.cjs +1 -1
  12. package/dist/components/embedded-search/use-inkeep-search.js +10 -10
  13. package/dist/components/embedded-search.d.cts +2 -2
  14. package/dist/components/embedded-search.d.ts +2 -2
  15. package/dist/components/embedded-search.js +79 -79
  16. package/dist/components/intelligent-form/intelligent-form-provider.cjs +1 -1
  17. package/dist/components/intelligent-form/intelligent-form-provider.d.cts +3 -3
  18. package/dist/components/intelligent-form/intelligent-form-provider.d.ts +3 -3
  19. package/dist/components/intelligent-form/intelligent-form-provider.js +2 -2
  20. package/dist/components/intelligent-form/use-inkeep-intelligent-form.cjs +1 -1
  21. package/dist/components/intelligent-form/use-inkeep-intelligent-form.d.cts +5 -5
  22. package/dist/components/intelligent-form/use-inkeep-intelligent-form.d.ts +5 -5
  23. package/dist/components/intelligent-form/use-inkeep-intelligent-form.js +88 -109
  24. package/dist/components/intelligent-form.cjs +1 -1
  25. package/dist/components/intelligent-form.d.cts +4 -3
  26. package/dist/components/intelligent-form.d.ts +4 -3
  27. package/dist/components/intelligent-form.js +191 -188
  28. package/dist/components/modal.cjs +1 -1
  29. package/dist/components/modal.d.cts +1 -1
  30. package/dist/components/modal.d.ts +1 -1
  31. package/dist/components/modal.js +26 -26
  32. package/dist/providers/base-events-provider.cjs +1 -1
  33. package/dist/providers/base-events-provider.js +1 -1
  34. package/dist/providers/chat-events-provider.cjs +1 -1
  35. package/dist/providers/chat-events-provider.d.cts +9 -1
  36. package/dist/providers/chat-events-provider.d.ts +9 -1
  37. package/dist/providers/chat-events-provider.js +54 -57
  38. package/dist/providers/chat-form-provider.cjs +1 -1
  39. package/dist/providers/chat-form-provider.d.cts +3 -3
  40. package/dist/providers/chat-form-provider.d.ts +3 -3
  41. package/dist/providers/chat-form-provider.js +17 -17
  42. package/dist/providers/feedback-provider.cjs +1 -1
  43. package/dist/providers/feedback-provider.js +23 -23
  44. package/dist/utils/default-settings.cjs +1 -1
  45. package/dist/utils/default-settings.d.cts +1 -0
  46. package/dist/utils/default-settings.d.ts +1 -0
  47. package/dist/utils/default-settings.js +10 -8
  48. package/dist/utils/misc.cjs +1 -1
  49. package/dist/utils/misc.d.cts +2 -2
  50. package/dist/utils/misc.d.ts +2 -2
  51. package/dist/utils/misc.js +15 -13
  52. package/package.json +5 -4
  53. package/dist/atoms/dialog.cjs +0 -1
  54. package/dist/atoms/dialog.js +0 -185
@@ -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:S,placeholder:Q,defaultQuery:N,debounceTimeMs:R,onQueryChange:O,searchFunctionsRef:x}=j,{logEvent:q}=X.useSearchEvents(),[c,C]=t.useState(N),T=t.useRef(null),[k,v]=t.useState(!1),[H,i]=t.useState(null),[B,a]=t.useState("NONE"),F=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),a(s[e][0].id)},[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,totalHits: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)})},R)},[R,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(()=>Q||(y?"Search...":"Search for anything..."),[Q,y]);return{results:s,resultsList:h,hasContent:h.length>0||k,loading:k,error:H,query:c,onInput:D,placeholder:K,tab:f,onTabChange:z,selectedItem:B,setSelectedItem:a,onSelectedItemChange:F,transitionsDisabled:$,inputRef:T,isMobile:y}};exports.useInkeepSearch=ee;
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:R,placeholder:S,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),a(s[e][0].id)},[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:R}}),[c,R]);t.useEffect(()=>{O?.(g.searchQuery),U(g)},[U,g]);const D=t.useCallback(e=>C(e.target.value),[]),K=t.useMemo(()=>S||(y?"Search...":"Search for anything..."),[S,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;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useState as s, useRef as l, useCallback as n, useEffect as j, useImperativeHandle as X, useMemo as T } from "react";
2
+ import { useState as s, useRef as l, useCallback as n, useEffect as j, useImperativeHandle as X, useMemo as R } from "react";
3
3
  import { useInkeepConfig as Y } from "../../providers/config-provider.js";
4
4
  import { useMediaQuery as Z } from "../../hooks/use-media-query.js";
5
5
  import ee from "./search-query.graphql.js";
@@ -8,14 +8,14 @@ import { useSearchEvents as re } from "../../providers/search-events-provider.js
8
8
  import { useInstantUpdate as se } from "../../hooks/use-instant-update.js";
9
9
  import { graphqlRequest as ne } from "../../utils/graphql-client.js";
10
10
  const me = () => {
11
- const { baseSettings: H, searchSettings: O } = Y(), { apiKey: R, aiApiBaseUrl: B, userAuthToken: h } = H, {
11
+ const { baseSettings: O, searchSettings: B } = Y(), { apiKey: T, aiApiBaseUrl: F, userAuthToken: h } = O, {
12
12
  maxResults: S,
13
13
  placeholder: C,
14
- defaultQuery: F,
14
+ defaultQuery: H,
15
15
  debounceTimeMs: k,
16
16
  onQueryChange: P,
17
17
  searchFunctionsRef: $
18
- } = O, { logEvent: v } = re(), [c, w] = s(F), A = l(null), [q, E] = s(!1), [z, f] = s(null), [D, a] = s("NONE"), K = n((e) => {
18
+ } = B, { logEvent: v } = 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
20
  }, []), [m, d] = s([]), t = te(m, c), [p, _] = s("All"), { disableTransition: x, disabled: W } = se(), G = n(
21
21
  (e) => {
@@ -43,13 +43,13 @@ const me = () => {
43
43
  A.current?.focus();
44
44
  }
45
45
  }));
46
- const I = `${B}/graphql`, L = T(
46
+ const I = `${F}/graphql`, L = R(
47
47
  () => ({
48
- Authorization: `Bearer ${R}`,
48
+ Authorization: `Bearer ${T}`,
49
49
  "Content-Type": "application/json",
50
50
  ...h ? { "User-Token": h } : {}
51
51
  }),
52
- [R, h]
52
+ [T, h]
53
53
  ), M = n(
54
54
  async (e) => {
55
55
  b.current && b.current.abort();
@@ -73,7 +73,7 @@ const me = () => {
73
73
  eventName: "search_query_response_received",
74
74
  properties: {
75
75
  searchQuery: e.searchQuery,
76
- totalHits: r?.length
76
+ totalResults: r?.length
77
77
  }
78
78
  });
79
79
  }, []), U = n(
@@ -94,7 +94,7 @@ const me = () => {
94
94
  }, k);
95
95
  },
96
96
  [k, M]
97
- ), Q = T(
97
+ ), Q = R(
98
98
  () => ({
99
99
  searchQuery: c,
100
100
  filters: {
@@ -109,7 +109,7 @@ const me = () => {
109
109
  const J = n(
110
110
  (e) => w(e.target.value),
111
111
  []
112
- ), V = T(
112
+ ), V = R(
113
113
  () => C || (y ? "Search..." : "Search for anything..."),
114
114
  [C, y]
115
115
  );
@@ -66,14 +66,14 @@ declare const PrimitiveInput: ForwardRefExoticComponent< PolymorphicProps & Omit
66
66
  ref?: React.Ref<HTMLInputElement>;
67
67
  } & {
68
68
  asChild?: boolean;
69
- }, "key" | "asChild" | keyof InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
69
+ }, "key" | "asChild" | keyof InputHTMLAttributes<HTMLInputElement>>, "value" | "type" | "onChange"> & {
70
70
  value?: string;
71
71
  onValueChange?: (search: string) => void;
72
72
  } & RefAttributes<HTMLInputElement>, "_id"> & Partial<Pick<Omit<Pick<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof InputHTMLAttributes<HTMLInputElement>> & {
73
73
  ref?: React.Ref<HTMLInputElement>;
74
74
  } & {
75
75
  asChild?: boolean;
76
- }, "key" | "asChild" | keyof InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
76
+ }, "key" | "asChild" | keyof InputHTMLAttributes<HTMLInputElement>>, "value" | "type" | "onChange"> & {
77
77
  value?: string;
78
78
  onValueChange?: (search: string) => void;
79
79
  } & RefAttributes<HTMLInputElement>, "_id">>>;
@@ -66,14 +66,14 @@ declare const PrimitiveInput: ForwardRefExoticComponent< PolymorphicProps & Omit
66
66
  ref?: React.Ref<HTMLInputElement>;
67
67
  } & {
68
68
  asChild?: boolean;
69
- }, "key" | "asChild" | keyof InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
69
+ }, "key" | "asChild" | keyof InputHTMLAttributes<HTMLInputElement>>, "value" | "type" | "onChange"> & {
70
70
  value?: string;
71
71
  onValueChange?: (search: string) => void;
72
72
  } & RefAttributes<HTMLInputElement>, "_id"> & Partial<Pick<Omit<Pick<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof InputHTMLAttributes<HTMLInputElement>> & {
73
73
  ref?: React.Ref<HTMLInputElement>;
74
74
  } & {
75
75
  asChild?: boolean;
76
- }, "key" | "asChild" | keyof InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
76
+ }, "key" | "asChild" | keyof InputHTMLAttributes<HTMLInputElement>>, "value" | "type" | "onChange"> & {
77
77
  value?: string;
78
78
  onValueChange?: (search: string) => void;
79
79
  } & RefAttributes<HTMLInputElement>, "_id">>>;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as a } from "react/jsx-runtime";
3
3
  import { Command as h } from "cmdk";
4
- import { ikp as i } from "./factory.js";
4
+ import { ikp as s } from "./factory.js";
5
5
  import { dataAttr as u, maybeRender as b } from "../utils/misc.js";
6
6
  import { forwardRef as v, useEffect as P, useState as B, useRef as x, useMemo as N } from "react";
7
7
  import { useSearch as c } from "./embedded-search/search-provider.js";
@@ -19,50 +19,50 @@ import { BuiltInIconRenderer as L } from "../atoms/icons/built-in-icon-renderer.
19
19
  import { highlightEmphasis as O } from "../utils/highlight-emphasis.js";
20
20
  import { useScrollingFades as W } from "../hooks/use-scrolling-fades.js";
21
21
  import { useColorModeValue as q } from "@inkeep/cxkit-color-mode";
22
- import H from "../atoms/avatars/ai.js";
22
+ import K from "../atoms/avatars/ai.js";
23
23
  import { useModal as y } from "./modal/modal-provider.js";
24
24
  import { useComposedRefs as f } from "../utils/compose-refs.js";
25
25
  import { composeEventHandlers as g } from "../utils/compose-event-handlers.js";
26
- const K = i("div", {
26
+ const G = s("div", {
27
27
  _id: "aiSearchWrapper"
28
28
  }), Ne = (t) => {
29
- const { isHidden: e, hasContent: r, isMobile: s } = c(), n = y();
29
+ const { isHidden: e, hasContent: r, isMobile: i } = c(), n = y();
30
30
  return /* @__PURE__ */ a(
31
- K,
31
+ G,
32
32
  {
33
33
  "data-hidden": u(e),
34
34
  "data-has-content": u(r),
35
35
  "data-in-modal": u(!!n),
36
- "data-mobile": u(s),
36
+ "data-mobile": u(i),
37
37
  ...t
38
38
  }
39
39
  );
40
- }, G = i(h, {
40
+ }, H = s(h, {
41
41
  _id: "aiSearchRoot"
42
42
  }), De = (t) => {
43
- const { isHidden: e, selectedItem: r, onSelectedItemChange: s } = c();
43
+ const { isHidden: e, selectedItem: r, onSelectedItemChange: i } = c();
44
44
  return /* @__PURE__ */ a(
45
- G,
45
+ H,
46
46
  {
47
47
  "data-hidden": u(e),
48
48
  shouldFilter: !1,
49
49
  loop: !1,
50
50
  value: r,
51
- onValueChange: s,
51
+ onValueChange: i,
52
52
  ...t
53
53
  }
54
54
  );
55
- }, Fe = i(h.List, {
55
+ }, Fe = s(h.List, {
56
56
  _id: "aiSearchContent"
57
- }), Ve = i("div", {
57
+ }), Ve = s("div", {
58
58
  _id: "aiSearchInputGroup"
59
- }), Ue = i(I, {
59
+ }), Ue = s(I, {
60
60
  _id: "aiSearchInputIcon",
61
61
  iconKey: "search"
62
- }), j = i(h.Input, {
62
+ }), j = s(h.Input, {
63
63
  _id: "aiSearchInput"
64
64
  }), Me = v(({ onInput: t, ...e }, r) => {
65
- const { query: s, onInput: n, placeholder: o, inputRef: l, shouldAutoFocusInput: d } = c(), S = f(r, l), R = y();
65
+ const { query: i, onInput: n, placeholder: o, inputRef: l, shouldAutoFocusInput: d } = c(), S = f(r, l), R = y();
66
66
  return P(() => {
67
67
  requestAnimationFrame(() => {
68
68
  d && l?.current && (l.current.focus(), l.current.selectionStart = l.current.value.length);
@@ -73,13 +73,13 @@ const K = i("div", {
73
73
  asChild: !0,
74
74
  ref: S,
75
75
  placeholder: o,
76
- value: s,
76
+ value: i,
77
77
  onInput: g(t, n),
78
78
  ...e,
79
79
  children: /* @__PURE__ */ a(F, { minRows: 1, maxLength: 1e3 })
80
80
  }
81
81
  );
82
- }), Q = i(L, {
82
+ }), Q = s(L, {
83
83
  _id: "aiSearchLoading",
84
84
  iconSettings: {
85
85
  builtIn: "LuLoaderCircle"
@@ -87,16 +87,16 @@ const K = i("div", {
87
87
  }), Oe = (t) => {
88
88
  const { loading: e, resultsList: r } = c();
89
89
  return !e || r.length === 0 ? null : /* @__PURE__ */ a(Q, { ...t });
90
- }, $ = i(h.Item, {
90
+ }, $ = s(h.Item, {
91
91
  _id: "aiAskAITrigger",
92
92
  value: "__ask_ai__"
93
93
  }), We = (t) => {
94
- const { setSelectedItem: e, results: r, tab: s } = c(), n = r[s]?.[0]?.id ?? "NONE";
94
+ const { setSelectedItem: e, results: r, tab: i } = c(), n = r[i]?.[0]?.id ?? "NONE";
95
95
  return /* @__PURE__ */ a($, { ...t, onPointerLeave: () => e(n) });
96
- }, z = i("img", {
96
+ }, z = s("img", {
97
97
  _id: "aiAskAITrigger__Icon"
98
98
  }), qe = (t) => {
99
- const { aiChatSettings: e } = T(), { aiAssistantAvatar: r } = e ?? {}, s = typeof r == "string" ? r : r?.light, n = (typeof r == "string" ? r : r?.dark) ?? s, o = q(s, n), [l, d] = B(o);
99
+ const { aiChatSettings: e } = T(), { aiAssistantAvatar: r } = e ?? {}, i = typeof r == "string" ? r : r?.light, n = (typeof r == "string" ? r : r?.dark) ?? i, o = q(i, n), [l, d] = B(o);
100
100
  return P(() => {
101
101
  d(o);
102
102
  }, [o]), /* @__PURE__ */ a(z, { asChild: !0, ...t, children: l ? (
@@ -113,60 +113,60 @@ const K = i("div", {
113
113
  ...t
114
114
  }
115
115
  )
116
- ) : /* @__PURE__ */ a(H, { "data-type": "icon", ...t }) });
117
- }, He = i("span", {
116
+ ) : /* @__PURE__ */ a(K, { "data-type": "icon", ...t }) });
117
+ }, Ke = s("span", {
118
118
  _id: "aiAskAITrigger__Label"
119
- }), Ke = i(I, {
119
+ }), Ge = s(I, {
120
120
  _id: "aiAskAITrigger__Indicator",
121
121
  iconKey: "openLinkInSameTab"
122
- }), J = i(_.Root, {
122
+ }), J = s(_.Root, {
123
123
  _id: "aiSearchResults"
124
- }), Ge = (t) => {
125
- const { tab: e, onTabChange: r, hasContent: s } = c();
124
+ }), He = (t) => {
125
+ const { tab: e, onTabChange: r, hasContent: i } = c();
126
126
  return /* @__PURE__ */ a(
127
127
  J,
128
128
  {
129
129
  value: e,
130
130
  onValueChange: r,
131
- "data-has-content": u(s),
131
+ "data-has-content": u(i),
132
132
  ...t
133
133
  }
134
134
  );
135
- }, X = i("div", {
135
+ }, X = s("div", {
136
136
  _id: "aiSearchResults__Loading"
137
137
  }), je = (t) => {
138
138
  const { loading: e, resultsList: r } = c();
139
139
  return !e || r.length > 0 ? null : /* @__PURE__ */ a(X, { ...t });
140
- }, Y = i(h.Empty, {
140
+ }, Y = s(h.Empty, {
141
141
  _id: "aiSearchResults__Empty"
142
142
  }), Qe = (t) => {
143
- const { query: e, loading: r, results: s, tab: n } = c(), o = s[n]?.length;
143
+ const { query: e, loading: r, results: i, tab: n } = c(), o = i[n]?.length;
144
144
  return r || !e || o ? null : /* @__PURE__ */ a(Y, { children: "No results found.", ...t });
145
- }, Z = i(_.List, {
145
+ }, Z = s(_.List, {
146
146
  _id: "aiSearchResults__TabList"
147
147
  }), $e = (t) => {
148
148
  const { children: e, ...r } = t, {
149
- searchSettings: { tabs: s }
149
+ searchSettings: { tabs: i }
150
150
  } = T(), { results: n, loading: o, resultsList: l } = c();
151
151
  if (o && l.length === 0) return null;
152
152
  const d = Object.keys(n);
153
- return !s.length || !d.length ? null : /* @__PURE__ */ a(Z, { children: b(e, d), ...r });
154
- }, ee = i(_.Trigger, {
153
+ return !i.length || !d.length ? null : /* @__PURE__ */ a(Z, { children: b(e, d), ...r });
154
+ }, ee = s(_.Trigger, {
155
155
  _id: "aiSearchResults__Tab"
156
156
  }), ze = (t) => {
157
- const { tab: e, ...r } = t, { results: s } = c(), n = s[e].length;
157
+ const { tab: e, ...r } = t, { results: i } = c(), n = i[e].length;
158
158
  return /* @__PURE__ */ a(ee, { value: e, children: `${e} (${n})`, ...r });
159
- }, te = i(p.Root, {
159
+ }, te = s(p.Root, {
160
160
  _id: "aiSearchResults__ScrollArea"
161
161
  }), Je = (t) => {
162
162
  const { loading: e, resultsList: r } = c();
163
163
  return e && r.length === 0 ? null : /* @__PURE__ */ a(te, { ...t });
164
- }, re = i(p.Viewport, {
164
+ }, re = s(p.Viewport, {
165
165
  _id: "aiSearchResults__ScrollAreaViewport"
166
166
  }), Xe = v(({ children: t, ...e }, r) => {
167
- const s = W(), n = f(r, s), { tab: o } = c();
167
+ const i = W(), n = f(r, i), { tab: o } = c();
168
168
  return P(() => {
169
- o && s.current?.scrollTo({ top: 0, behavior: "auto" });
169
+ o && i.current?.scrollTo({ top: 0, behavior: "auto" });
170
170
  }, [o]), /* @__PURE__ */ a(
171
171
  re,
172
172
  {
@@ -178,21 +178,21 @@ const K = i("div", {
178
178
  ...e
179
179
  }
180
180
  );
181
- }), Ye = i(
181
+ }), Ye = s(
182
182
  p.ScrollAreaScrollbar,
183
183
  {
184
184
  _id: "aiSearchResults__ScrollAreaScrollbar"
185
185
  }
186
- ), Ze = i(p.ScrollAreaThumb, {
186
+ ), Ze = s(p.ScrollAreaThumb, {
187
187
  _id: "aiSearchResults__ScrollAreaThumb"
188
- }), et = i(p.Corner, {
188
+ }), et = s(p.Corner, {
189
189
  _id: "aiSearchResults__ScrollAreaCorner"
190
- }), ie = i(_.Content, {
190
+ }), se = s(_.Content, {
191
191
  _id: "aiSearchResults__List"
192
192
  }), tt = (t) => {
193
- const { children: e, ...r } = t, { results: s, tab: n } = c(), o = s[n] ?? [];
193
+ const { children: e, ...r } = t, { results: i, tab: n } = c(), o = i[n] ?? [];
194
194
  return /* @__PURE__ */ a(
195
- ie,
195
+ se,
196
196
  {
197
197
  value: n,
198
198
  "data-has-results": u(o.length > 0),
@@ -201,10 +201,10 @@ const K = i("div", {
201
201
  ...r
202
202
  }
203
203
  );
204
- }, se = i(h.Item, {
204
+ }, ie = s(h.Item, {
205
205
  _id: "aiSearchResults__Item",
206
206
  asChild: !0
207
- }), rt = v(({ item: t, onClick: e, onSelect: r, children: s, ...n }, o) => {
207
+ }), rt = v(({ item: t, onClick: e, onSelect: r, children: i, ...n }, o) => {
208
208
  const {
209
209
  searchSettings: { shouldOpenLinksInNewTab: l }
210
210
  } = T(), { logEvent: d } = V(), { query: S, transitionsDisabled: R } = c(), A = x(null), k = f(o, A), C = () => {
@@ -220,7 +220,7 @@ const K = i("div", {
220
220
  });
221
221
  }, E = l || !!t.shouldOpenInNewTab;
222
222
  return /* @__PURE__ */ a(M, { source: { ...t, isExternal: E }, children: /* @__PURE__ */ a(
223
- se,
223
+ ie,
224
224
  {
225
225
  ref: k,
226
226
  value: t.id,
@@ -236,62 +236,62 @@ const K = i("div", {
236
236
  href: t.url,
237
237
  isExternal: E,
238
238
  appendToUrl: t.appendToUrl,
239
- children: s
239
+ children: i
240
240
  }
241
241
  )
242
242
  }
243
243
  ) });
244
- }), ae = i("div", {
244
+ }), ae = s("div", {
245
245
  _id: "aiSearchResults__ItemBreadcrumbs"
246
- }), it = (t) => {
246
+ }), st = (t) => {
247
247
  const { source: e } = m(), { tab: r } = c();
248
248
  if (!e.breadcrumbs?.length) return null;
249
- const { children: s, ...n } = t, l = e.tabs?.find((d) => typeof d != "string" && d[0] === r)?.[1]?.breadcrumbs ?? e.breadcrumbs ?? [];
250
- return /* @__PURE__ */ a(ae, { children: b(s, l), ...n });
251
- }, st = i(I, {
249
+ const { children: i, ...n } = t, l = e.tabs?.find((d) => typeof d != "string" && d[0] === r)?.[1]?.breadcrumbs ?? e.breadcrumbs ?? [];
250
+ return /* @__PURE__ */ a(ae, { children: b(i, l), ...n });
251
+ }, it = s(I, {
252
252
  _id: "aiSearchResults__ItemBreadcrumbIcon",
253
253
  iconKey: "breadcrumbSeparator"
254
- }), ne = i(L, {
254
+ }), ne = s(L, {
255
255
  _id: "aiSearchResults__ItemIcon"
256
256
  }), at = (t) => {
257
257
  const { source: e } = m();
258
258
  return /* @__PURE__ */ a(ne, { iconSettings: e.icon, "data-type": e.type, ...t });
259
- }, oe = i("span", {
259
+ }, oe = s("span", {
260
260
  _id: "aiSearchResults__ItemTitle"
261
261
  }), nt = (t) => {
262
262
  const { source: e } = m();
263
263
  return /* @__PURE__ */ a(oe, { "data-type": e.type, children: e.title, ...t });
264
- }, ce = i("span", {
264
+ }, ce = s("span", {
265
265
  _id: "aiSearchResults__ItemTag"
266
266
  }), ot = (t) => {
267
267
  const { source: e } = m();
268
268
  return /* @__PURE__ */ a(ce, { "data-type": e.type, children: e.tag, ...t });
269
- }, le = i("span", {
269
+ }, le = s("span", {
270
270
  _id: "aiSearchResults__ItemDescription"
271
271
  }), ct = (t) => {
272
- const { source: e } = m(), { children: r, ...s } = t, n = N(() => e.description ? O(e.description) : [], [e.description]);
272
+ const { source: e } = m(), { children: r, ...i } = t, n = N(() => e.description ? O(e.description) : [], [e.description]);
273
273
  return n.length ? /* @__PURE__ */ a(
274
274
  le,
275
275
  {
276
276
  "data-type": e.type,
277
277
  children: b(r, n),
278
- ...s
278
+ ...i
279
279
  }
280
280
  ) : null;
281
- }, de = i("span", {
281
+ }, de = s("span", {
282
282
  _id: "aiSearchResults__ItemDescriptionPart"
283
283
  }), lt = (t) => {
284
- const { part: e, ...r } = t, { source: s } = m();
284
+ const { part: e, ...r } = t, { source: i } = m();
285
285
  return typeof e == "string" ? e : /* @__PURE__ */ a(
286
286
  de,
287
287
  {
288
- "data-type": s.type,
288
+ "data-type": i.type,
289
289
  children: e.content,
290
290
  "data-highlighted": u(e.highlighted),
291
291
  ...r
292
292
  }
293
293
  );
294
- }, ue = i(I, {
294
+ }, ue = s(I, {
295
295
  _id: "aiSearchResults__ItemIndicator"
296
296
  }), dt = (t) => {
297
297
  const { source: e } = m();
@@ -302,19 +302,19 @@ const K = i("div", {
302
302
  ...t
303
303
  }
304
304
  );
305
- }, me = i("div", {
305
+ }, me = s("div", {
306
306
  _id: "aiSearchFooter"
307
307
  }), ut = (t) => {
308
308
  const { resultsList: e } = c();
309
309
  return /* @__PURE__ */ a(me, { "data-has-results": u(e.length > 0), ...t });
310
- }, mt = i("div", {
310
+ }, mt = s("div", {
311
311
  _id: "aiSearchTagline__Container"
312
- }), ht = i("span", {
312
+ }), ht = s("span", {
313
313
  _id: "aiSearchTagline__Text",
314
314
  children: "Powered by"
315
- }), pt = i(D, {
315
+ }), pt = s(D, {
316
316
  _id: "aiSearchTagline__Logo"
317
- }), St = i("a", {
317
+ }), St = s("a", {
318
318
  _id: "aiSearchTagline__BrandName",
319
319
  children: "inkeep",
320
320
  href: "https://www.inkeep.com/",
@@ -324,23 +324,23 @@ const K = i("div", {
324
324
  export {
325
325
  We as AskAITrigger,
326
326
  qe as AskAITriggerIcon,
327
- Ke as AskAITriggerIndicator,
328
- He as AskAITriggerLabel,
327
+ Ge as AskAITriggerIndicator,
328
+ Ke as AskAITriggerLabel,
329
329
  Fe as Content,
330
330
  Ue as EmbeddedSearchInputIcon,
331
331
  We as EmbeddedSearchPrimitiveAskAITrigger,
332
332
  qe as EmbeddedSearchPrimitiveAskAITriggerIcon,
333
- Ke as EmbeddedSearchPrimitiveAskAITriggerIndicator,
334
- He as EmbeddedSearchPrimitiveAskAITriggerLabel,
333
+ Ge as EmbeddedSearchPrimitiveAskAITriggerIndicator,
334
+ Ke as EmbeddedSearchPrimitiveAskAITriggerLabel,
335
335
  Fe as EmbeddedSearchPrimitiveContent,
336
336
  ut as EmbeddedSearchPrimitiveFooter,
337
337
  Me as EmbeddedSearchPrimitiveInput,
338
338
  Ve as EmbeddedSearchPrimitiveInputGroup,
339
339
  Oe as EmbeddedSearchPrimitiveLoading,
340
- Ge as EmbeddedSearchPrimitiveResults,
340
+ He as EmbeddedSearchPrimitiveResults,
341
341
  Qe as EmbeddedSearchPrimitiveResultsEmpty,
342
342
  rt as EmbeddedSearchPrimitiveResultsItem,
343
- it as EmbeddedSearchPrimitiveResultsItemBreadcrumbs,
343
+ st as EmbeddedSearchPrimitiveResultsItemBreadcrumbs,
344
344
  ct as EmbeddedSearchPrimitiveResultsItemDescription,
345
345
  lt as EmbeddedSearchPrimitiveResultsItemDescriptionPart,
346
346
  at as EmbeddedSearchPrimitiveResultsItemIcon,
@@ -361,11 +361,11 @@ export {
361
361
  Ue as InputIcon,
362
362
  Oe as Loading,
363
363
  It as Provider,
364
- Ge as Results,
364
+ He as Results,
365
365
  Qe as ResultsEmpty,
366
366
  rt as ResultsItem,
367
- st as ResultsItemBreadcrumbIcon,
368
- it as ResultsItemBreadcrumbs,
367
+ it as ResultsItemBreadcrumbIcon,
368
+ st as ResultsItemBreadcrumbs,
369
369
  ct as ResultsItemDescription,
370
370
  lt as ResultsItemDescriptionPart,
371
371
  at as ResultsItemIcon,
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),s=require("./use-inkeep-intelligent-form.cjs"),u=require("../../providers/conversation-provider.cjs"),c=require("../../providers/chat-events-provider.cjs"),n=r.createContext(void 0),o=({children:e,formConfig:i})=>{const l=s.useInkeepIntelligentForm({formConfig:i});return t.jsx(n.Provider,{value:l,children:e})},m=e=>t.jsx(u.InkeepConversationProvider,{children:t.jsx(c.ChatEventsProviderWithBase,{children:t.jsx(o,{...e})})}),v=()=>{const e=r.useContext(n);if(!e)throw new Error("useIntelligentForm must be used within a IntelligentFormProvider");return e};exports.IntelligentFormProvider=m;exports.IntelligentFormProviderImpl=o;exports.useIntelligentForm=v;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),s=require("./use-inkeep-intelligent-form.cjs"),u=require("../../providers/conversation-provider.cjs"),c=require("../../providers/chat-events-provider.cjs"),n=r.createContext(void 0),o=({children:e,formSettings:i})=>{const l=s.useInkeepIntelligentForm({formSettings:i});return t.jsx(n.Provider,{value:l,children:e})},m=e=>t.jsx(u.InkeepConversationProvider,{children:t.jsx(c.ChatEventsProviderWithBase,{children:t.jsx(o,{...e})})}),v=()=>{const e=r.useContext(n);if(!e)throw new Error("useIntelligentForm must be used within a IntelligentFormProvider");return e};exports.IntelligentFormProvider=m;exports.IntelligentFormProviderImpl=o;exports.useIntelligentForm=v;
@@ -1,16 +1,16 @@
1
1
  import { useInkeepIntelligentForm, AIResponse } from './use-inkeep-intelligent-form';
2
- import { IntelligentFormConfig } from '@inkeep/cxkit-types';
2
+ import { IntelligentFormSettings } from '@inkeep/cxkit-types';
3
3
  import { Control, FieldErrors, Message } from 'react-hook-form';
4
4
  import { Dispatch, SetStateAction } from 'react';
5
5
  export type IntelligentFormContextValue = ReturnType<typeof useInkeepIntelligentForm>;
6
6
  export interface IntelligentFormProviderProps {
7
7
  children: React.ReactNode;
8
- formConfig: IntelligentFormConfig;
8
+ formSettings: IntelligentFormSettings;
9
9
  }
10
10
  export declare const IntelligentFormProviderImpl: React.FC<IntelligentFormProviderProps>;
11
11
  export declare const IntelligentFormProvider: React.FC<IntelligentFormProviderProps>;
12
12
  export declare const useIntelligentForm: () => {
13
- formConfig: IntelligentFormConfig;
13
+ formSettings: IntelligentFormSettings;
14
14
  control: Control<Record<string, any>, any>;
15
15
  errors: FieldErrors<Record<string, any>>;
16
16
  isSubmitSuccessful: boolean;
@@ -1,16 +1,16 @@
1
1
  import { useInkeepIntelligentForm, AIResponse } from './use-inkeep-intelligent-form';
2
- import { IntelligentFormConfig } from '@inkeep/cxkit-types';
2
+ import { IntelligentFormSettings } from '@inkeep/cxkit-types';
3
3
  import { Control, FieldErrors, Message } from 'react-hook-form';
4
4
  import { Dispatch, SetStateAction } from 'react';
5
5
  export type IntelligentFormContextValue = ReturnType<typeof useInkeepIntelligentForm>;
6
6
  export interface IntelligentFormProviderProps {
7
7
  children: React.ReactNode;
8
- formConfig: IntelligentFormConfig;
8
+ formSettings: IntelligentFormSettings;
9
9
  }
10
10
  export declare const IntelligentFormProviderImpl: React.FC<IntelligentFormProviderProps>;
11
11
  export declare const IntelligentFormProvider: React.FC<IntelligentFormProviderProps>;
12
12
  export declare const useIntelligentForm: () => {
13
- formConfig: IntelligentFormConfig;
13
+ formSettings: IntelligentFormSettings;
14
14
  control: Control<Record<string, any>, any>;
15
15
  errors: FieldErrors<Record<string, any>>;
16
16
  isSubmitSuccessful: boolean;
@@ -6,9 +6,9 @@ import { InkeepConversationProvider as s } from "../../providers/conversation-pr
6
6
  import { ChatEventsProviderWithBase as c } from "../../providers/chat-events-provider.js";
7
7
  const r = i(void 0), u = ({
8
8
  children: e,
9
- formConfig: o
9
+ formSettings: o
10
10
  }) => {
11
- const n = m({ formConfig: o });
11
+ const n = m({ formSettings: o });
12
12
  return /* @__PURE__ */ t(r.Provider, { value: n, children: e });
13
13
  }, F = (e) => /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(c, { children: /* @__PURE__ */ t(u, { ...e }) }) }), a = () => {
14
14
  const e = l(r);
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=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"),ne="root.serverError",q=async(g,r)=>{if(r)return;const i=await re.fetchAndSolveChallenge(`${g}/v1/challenge`);if(i)return{"X-INKEEP-CHALLENGE-SOLUTION":btoa(JSON.stringify(i))}},oe=g=>{const{formConfig:r}=g,{baseSettings:i}=Y.useInkeepConfig(),{conversation:n}=Z.useInkeepConversation(),{logEvent:a}=ee.useChatEvents(),{aiApiBaseUrl:d,shouldBypassCaptcha:v}=i,y=t.useMemo(()=>new D({baseURL:`${d}/v1`,apiKey:i.apiKey,dangerouslyAllowBrowser:!0}),[i.apiKey,d]),[R,S]=t.useState(!1),[M,V]=t.useState(!1),[A,p]=t.useState(!1),[F,h]=t.useState({}),l=t.useMemo(()=>{const{primary:o,secondary:u}=r;return W.getFormDefaultValues([...o.fields,...u.fields])},[r]),{control:_,handleSubmit:N,formState:{errors:C,isSubmitting:P,isSubmitSuccessful:O},reset:b,trigger:k,setValue:x,setError:H}=J.useForm({defaultValues:l});t.useEffect(()=>{l&&b(l)},[b,l]);const L=async o=>{const u=typeof window>"u"?"":window.location.href;try{await r.onSubmit({values:o,conversation:n,client:{currentUrl:u}}),a({eventName:"intelligent_form_submitted",properties:{conversationId:n.id,values:o}})}catch(c){H(ne,{message:c instanceof Error?c.message:"Something went wrong."}),a({eventName:"intelligent_form_submission_error",properties:{conversationId:n.id,error:c instanceof Error?c.message:"Something went wrong."}})}},K=async()=>{const o=r.primary.fields.map(e=>e.name);if(!await k(o))return;V(!0),S(!0);const c=_._formValues,E=r.primary.fields.reduce((e,m)=>(e[m.name]=c[m.name],e),{}),B=r.secondary.fields.filter(e=>e.shouldPrefillWithAI!==!1),I=se.getQAModelMessages(E);a({eventName:"intelligent_form_primary_submitted",properties:{conversationId:n.id,fields:o,messages:I}});try{const e=await q(d,v),m=await q(d,v),[s,f]=await Promise.all([X.generateQAModelResponse(I,y,e),z.generateContextModelResponse({primaryFieldValues:E,fieldsToGenerate:B},y,m)]);if(a({eventName:"intelligent_form_qa_response",properties:{conversationId:n.id,messages:s.messages,answer:s.answer??"",confidence:s.aiAnnotations?.answerConfidence,recordsConsidered:s.recordsConsidered}}),f.suggestedValues){for(const[Q,$]of Object.entries(f.suggestedValues))x(Q,$);a({eventName:"intelligent_form_context_suggestions",properties:{conversationId:n.id,suggestedFields:Object.keys(f.suggestedValues)}})}const w=s.aiAnnotations?.answerConfidence,T=w&&["very_confident","somewhat_confident"].includes(w),G=s.recordsConsidered&&s.recordsConsidered.length>0;T&&G&&s.answer?h({answer:s.answer,answerConfidence:w,recordsConsidered:s.recordsConsidered}):(p(!0),h({answer:null,recordsConsidered:s.recordsConsidered,suggestedValues:f.suggestedValues}))}catch(e){console.error(e),p(!0),a({eventName:"intelligent_form_ai_error",properties:{conversationId:n.id,error:e instanceof Error?e.message:"Something went wrong."}})}finally{S(!1)}},U=N(L),j=C?.root?.serverError;return{formConfig:r,control:_,errors:C,isSubmitSuccessful:O,isSubmitting:P,handleSubmit:U,loading:R,formError:j,submittedPrimaryForm:M,handleSubmitPrimaryForm:K,aiResponse:F,showSecondaryFields:A,setShowSecondaryFields:p}};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",_=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,8 +1,8 @@
1
- import { AnswerConfidence, IntelligentFormConfig, SourceItem } from '@inkeep/cxkit-types';
1
+ import { AnswerConfidence, IntelligentFormSettings, SourceItem } from '@inkeep/cxkit-types';
2
2
  import { Control, FieldErrors, Message } from 'react-hook-form';
3
3
  import { Dispatch, SetStateAction } from 'react';
4
- export interface InkeepIntelligentFormConfig {
5
- formConfig: IntelligentFormConfig;
4
+ export interface InkeepIntelligentFormSettings {
5
+ formSettings: IntelligentFormSettings;
6
6
  }
7
7
  export interface AIResponse {
8
8
  answer?: string | null;
@@ -10,8 +10,8 @@ export interface AIResponse {
10
10
  recordsConsidered?: SourceItem[];
11
11
  suggestedValues?: Record<string, unknown>;
12
12
  }
13
- export declare const useInkeepIntelligentForm: (props: InkeepIntelligentFormConfig) => {
14
- formConfig: IntelligentFormConfig;
13
+ export declare const useInkeepIntelligentForm: (props: InkeepIntelligentFormSettings) => {
14
+ formSettings: IntelligentFormSettings;
15
15
  control: Control<Record<string, any>, any>;
16
16
  errors: FieldErrors<Record<string, any>>;
17
17
  isSubmitSuccessful: boolean;
@@ -1,8 +1,8 @@
1
- import { AnswerConfidence, IntelligentFormConfig, SourceItem } from '@inkeep/cxkit-types';
1
+ import { AnswerConfidence, IntelligentFormSettings, SourceItem } from '@inkeep/cxkit-types';
2
2
  import { Control, FieldErrors, Message } from 'react-hook-form';
3
3
  import { Dispatch, SetStateAction } from 'react';
4
- export interface InkeepIntelligentFormConfig {
5
- formConfig: IntelligentFormConfig;
4
+ export interface InkeepIntelligentFormSettings {
5
+ formSettings: IntelligentFormSettings;
6
6
  }
7
7
  export interface AIResponse {
8
8
  answer?: string | null;
@@ -10,8 +10,8 @@ export interface AIResponse {
10
10
  recordsConsidered?: SourceItem[];
11
11
  suggestedValues?: Record<string, unknown>;
12
12
  }
13
- export declare const useInkeepIntelligentForm: (props: InkeepIntelligentFormConfig) => {
14
- formConfig: IntelligentFormConfig;
13
+ export declare const useInkeepIntelligentForm: (props: InkeepIntelligentFormSettings) => {
14
+ formSettings: IntelligentFormSettings;
15
15
  control: Control<Record<string, any>, any>;
16
16
  errors: FieldErrors<Record<string, any>>;
17
17
  isSubmitSuccessful: boolean;