@inkeep/cxkit-primitives 0.5.5 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atoms/api/analytics/events.cjs +1 -1
- package/dist/atoms/api/analytics/events.js +2 -2
- package/dist/components/embedded-chat/use-chat-action.cjs +1 -1
- package/dist/components/embedded-chat/use-chat-action.js +14 -16
- package/dist/components/embedded-chat/use-inkeep-chat.cjs +3 -3
- package/dist/components/embedded-chat/use-inkeep-chat.js +122 -128
- package/dist/components/embedded-chat.cjs +5 -5
- package/dist/components/embedded-chat.d.cts +9 -8
- package/dist/components/embedded-chat.d.ts +9 -8
- package/dist/components/embedded-chat.js +952 -963
- package/dist/components/embedded-search/use-inkeep-search.cjs +1 -1
- package/dist/components/embedded-search/use-inkeep-search.js +10 -10
- package/dist/components/embedded-search.d.cts +2 -2
- package/dist/components/embedded-search.d.ts +2 -2
- package/dist/components/embedded-search.js +79 -79
- package/dist/components/intelligent-form/intelligent-form-provider.cjs +1 -1
- package/dist/components/intelligent-form/intelligent-form-provider.d.cts +3 -3
- package/dist/components/intelligent-form/intelligent-form-provider.d.ts +3 -3
- package/dist/components/intelligent-form/intelligent-form-provider.js +2 -2
- package/dist/components/intelligent-form/use-inkeep-intelligent-form.cjs +1 -1
- package/dist/components/intelligent-form/use-inkeep-intelligent-form.d.cts +5 -5
- package/dist/components/intelligent-form/use-inkeep-intelligent-form.d.ts +5 -5
- package/dist/components/intelligent-form/use-inkeep-intelligent-form.js +88 -109
- package/dist/components/intelligent-form.cjs +1 -1
- package/dist/components/intelligent-form.d.cts +4 -3
- package/dist/components/intelligent-form.d.ts +4 -3
- package/dist/components/intelligent-form.js +191 -188
- package/dist/components/modal.cjs +1 -1
- package/dist/components/modal.d.cts +1 -1
- package/dist/components/modal.d.ts +1 -1
- package/dist/components/modal.js +26 -26
- package/dist/providers/base-events-provider.cjs +1 -1
- package/dist/providers/base-events-provider.js +1 -1
- package/dist/providers/chat-events-provider.cjs +1 -1
- package/dist/providers/chat-events-provider.d.cts +9 -1
- package/dist/providers/chat-events-provider.d.ts +9 -1
- package/dist/providers/chat-events-provider.js +54 -57
- package/dist/providers/chat-form-provider.cjs +1 -1
- package/dist/providers/chat-form-provider.d.cts +3 -3
- package/dist/providers/chat-form-provider.d.ts +3 -3
- package/dist/providers/chat-form-provider.js +17 -17
- package/dist/providers/feedback-provider.cjs +1 -1
- package/dist/providers/feedback-provider.js +23 -23
- package/dist/utils/default-settings.cjs +1 -1
- package/dist/utils/default-settings.d.cts +1 -0
- package/dist/utils/default-settings.d.ts +1 -0
- package/dist/utils/default-settings.js +13 -11
- package/dist/utils/misc.cjs +1 -1
- package/dist/utils/misc.d.cts +2 -2
- package/dist/utils/misc.d.ts +2 -2
- package/dist/utils/misc.js +15 -13
- package/package.json +5 -4
- package/dist/atoms/dialog.cjs +0 -1
- package/dist/atoms/dialog.js +0 -185
|
@@ -1,157 +1,136 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import J from "openai";
|
|
3
|
-
import { useMemo as
|
|
3
|
+
import { useMemo as R, useState as l, 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";
|
|
7
7
|
import { generateContextModelResponse as Z } from "./actions/context-model-response.js";
|
|
8
8
|
import { useInkeepConfig as ee } from "../../providers/config-provider.js";
|
|
9
|
-
import { useInkeepConversation as
|
|
10
|
-
import { useChatEvents as
|
|
9
|
+
import { useInkeepConversation as se } from "../../providers/conversation-provider.js";
|
|
10
|
+
import { useChatEvents as re } from "../../providers/chat-events-provider.js";
|
|
11
11
|
import { getQAModelMessages as oe } from "./actions/qa-model-messages.js";
|
|
12
|
-
import { fetchAndSolveChallenge as
|
|
13
|
-
const
|
|
12
|
+
import { fetchAndSolveChallenge as te } from "../embedded-chat/use-captcha.js";
|
|
13
|
+
const ne = "root.serverError", V = async (c, s) => {
|
|
14
14
|
if (s) return;
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
15
|
+
const o = await te(`${c}/v1/challenge`);
|
|
16
|
+
if (o)
|
|
17
17
|
return {
|
|
18
|
-
"X-INKEEP-CHALLENGE-SOLUTION": btoa(JSON.stringify(
|
|
18
|
+
"X-INKEEP-CHALLENGE-SOLUTION": btoa(JSON.stringify(o))
|
|
19
19
|
};
|
|
20
|
-
},
|
|
21
|
-
const {
|
|
20
|
+
}, we = (c) => {
|
|
21
|
+
const { formSettings: s } = c, { baseSettings: o } = ee(), { conversation: y } = se(), { logEvent: m } = re(), { aiApiBaseUrl: i, shouldBypassCaptcha: w } = o, S = R(
|
|
22
22
|
() => new J({
|
|
23
|
-
baseURL: `${
|
|
24
|
-
apiKey:
|
|
23
|
+
baseURL: `${i}/v1`,
|
|
24
|
+
apiKey: o.apiKey,
|
|
25
25
|
dangerouslyAllowBrowser: !0
|
|
26
26
|
}),
|
|
27
|
-
[
|
|
28
|
-
), [
|
|
29
|
-
const { primary:
|
|
30
|
-
return z([...
|
|
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]);
|
|
31
31
|
}, [s]), {
|
|
32
|
-
control:
|
|
33
|
-
handleSubmit:
|
|
34
|
-
formState: { errors:
|
|
35
|
-
reset:
|
|
32
|
+
control: b,
|
|
33
|
+
handleSubmit: O,
|
|
34
|
+
formState: { errors: v, isSubmitting: P, isSubmitSuccessful: L },
|
|
35
|
+
reset: E,
|
|
36
36
|
trigger: k,
|
|
37
|
-
setValue:
|
|
38
|
-
setError:
|
|
37
|
+
setValue: x,
|
|
38
|
+
setError: H
|
|
39
39
|
} = X({
|
|
40
|
-
defaultValues:
|
|
40
|
+
defaultValues: a
|
|
41
41
|
});
|
|
42
42
|
W(() => {
|
|
43
|
-
|
|
44
|
-
}, [
|
|
45
|
-
const
|
|
46
|
-
const l = typeof window > "u" ? "" : window.location.href;
|
|
43
|
+
a && E(a);
|
|
44
|
+
}, [E, a]);
|
|
45
|
+
const K = async (t) => {
|
|
47
46
|
try {
|
|
48
|
-
await s.onSubmit({
|
|
49
|
-
values:
|
|
50
|
-
conversation:
|
|
51
|
-
|
|
52
|
-
}), i({
|
|
47
|
+
await s.buttons.submit.onSubmit({
|
|
48
|
+
values: t,
|
|
49
|
+
conversation: y
|
|
50
|
+
}), m({
|
|
53
51
|
eventName: "intelligent_form_submitted",
|
|
54
52
|
properties: {
|
|
55
|
-
|
|
56
|
-
values:
|
|
53
|
+
conversation: y,
|
|
54
|
+
values: t
|
|
57
55
|
}
|
|
58
56
|
});
|
|
59
|
-
} catch (
|
|
60
|
-
|
|
61
|
-
message:
|
|
62
|
-
}), i({
|
|
63
|
-
eventName: "intelligent_form_submission_error",
|
|
64
|
-
properties: {
|
|
65
|
-
conversationId: o.id,
|
|
66
|
-
error: a instanceof Error ? a.message : "Something went wrong."
|
|
67
|
-
}
|
|
57
|
+
} catch (n) {
|
|
58
|
+
H(ne, {
|
|
59
|
+
message: n instanceof Error ? n.message : "Something went wrong."
|
|
68
60
|
});
|
|
69
61
|
}
|
|
70
|
-
},
|
|
71
|
-
const
|
|
72
|
-
if (!await k(
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
(e,
|
|
62
|
+
}, 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),
|
|
76
68
|
{}
|
|
77
69
|
), G = s.secondary.fields.filter(
|
|
78
70
|
(e) => e.shouldPrefillWithAI !== !1
|
|
79
|
-
),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
});
|
|
71
|
+
), f = oe(_);
|
|
72
|
+
m(
|
|
73
|
+
{
|
|
74
|
+
eventName: "intelligent_form_primary_section_submitted",
|
|
75
|
+
properties: {}
|
|
76
|
+
},
|
|
77
|
+
f
|
|
78
|
+
);
|
|
88
79
|
try {
|
|
89
|
-
const e = await
|
|
90
|
-
Y(
|
|
80
|
+
const e = await V(i, w), d = await V(i, w), [r, p] = await Promise.all([
|
|
81
|
+
Y(f, S, e),
|
|
91
82
|
Z(
|
|
92
|
-
{ primaryFieldValues:
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
{ primaryFieldValues: _, fieldsToGenerate: G },
|
|
84
|
+
S,
|
|
85
|
+
d
|
|
95
86
|
)
|
|
96
87
|
]);
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
answer: r.answer ?? "",
|
|
103
|
-
confidence: r.aiAnnotations?.answerConfidence,
|
|
104
|
-
recordsConsidered: r.recordsConsidered
|
|
105
|
-
}
|
|
106
|
-
}), f.suggestedValues) {
|
|
107
|
-
for (const [$, D] of Object.entries(f.suggestedValues))
|
|
108
|
-
H($, D);
|
|
109
|
-
i({
|
|
110
|
-
eventName: "intelligent_form_context_suggestions",
|
|
111
|
-
properties: {
|
|
112
|
-
conversationId: o.id,
|
|
113
|
-
suggestedFields: Object.keys(f.suggestedValues)
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
const w = r.aiAnnotations?.answerConfidence, Q = w && ["very_confident", "somewhat_confident"].includes(w), T = r.recordsConsidered && r.recordsConsidered.length > 0;
|
|
118
|
-
Q && T && r.answer ? S({
|
|
88
|
+
if (p.suggestedValues)
|
|
89
|
+
for (const [$, j] of Object.entries(p.suggestedValues))
|
|
90
|
+
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({
|
|
119
93
|
answer: r.answer,
|
|
120
|
-
answerConfidence:
|
|
94
|
+
answerConfidence: g,
|
|
121
95
|
recordsConsidered: r.recordsConsidered
|
|
122
|
-
})
|
|
96
|
+
}), m(
|
|
97
|
+
{
|
|
98
|
+
eventName: "intelligent_form_ai_response_provided",
|
|
99
|
+
properties: {
|
|
100
|
+
recordsConsidered: r.recordsConsidered
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
[
|
|
104
|
+
...f,
|
|
105
|
+
{ id: Date.now().toString(), role: "assistant", content: r.answer, links: [] }
|
|
106
|
+
]
|
|
107
|
+
)) : (u(!0), C({
|
|
123
108
|
answer: null,
|
|
124
109
|
recordsConsidered: r.recordsConsidered,
|
|
125
|
-
suggestedValues:
|
|
110
|
+
suggestedValues: p.suggestedValues
|
|
126
111
|
}));
|
|
127
112
|
} catch (e) {
|
|
128
|
-
console.error(e),
|
|
129
|
-
eventName: "intelligent_form_ai_error",
|
|
130
|
-
properties: {
|
|
131
|
-
conversationId: o.id,
|
|
132
|
-
error: e instanceof Error ? e.message : "Something went wrong."
|
|
133
|
-
}
|
|
134
|
-
});
|
|
113
|
+
console.error(e), u(!0);
|
|
135
114
|
} finally {
|
|
136
115
|
h(!1);
|
|
137
116
|
}
|
|
138
|
-
},
|
|
117
|
+
}, U = O(K), q = v?.root?.serverError;
|
|
139
118
|
return {
|
|
140
|
-
|
|
141
|
-
control:
|
|
142
|
-
errors:
|
|
119
|
+
formSettings: s,
|
|
120
|
+
control: b,
|
|
121
|
+
errors: v,
|
|
143
122
|
isSubmitSuccessful: L,
|
|
144
|
-
isSubmitting:
|
|
145
|
-
handleSubmit:
|
|
146
|
-
loading:
|
|
147
|
-
formError:
|
|
148
|
-
submittedPrimaryForm:
|
|
149
|
-
handleSubmitPrimaryForm:
|
|
150
|
-
aiResponse:
|
|
151
|
-
showSecondaryFields:
|
|
152
|
-
setShowSecondaryFields:
|
|
123
|
+
isSubmitting: P,
|
|
124
|
+
handleSubmit: U,
|
|
125
|
+
loading: A,
|
|
126
|
+
formError: q,
|
|
127
|
+
submittedPrimaryForm: F,
|
|
128
|
+
handleSubmitPrimaryForm: B,
|
|
129
|
+
aiResponse: M,
|
|
130
|
+
showSecondaryFields: N,
|
|
131
|
+
setShowSecondaryFields: u
|
|
153
132
|
};
|
|
154
133
|
};
|
|
155
134
|
export {
|
|
156
|
-
|
|
135
|
+
we as useInkeepIntelligentForm
|
|
157
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("./factory.cjs"),F=require("react"),y=require("react-textarea-autosize"),je=require("@radix-ui/react-select"),Ae=require("@radix-ui/react-checkbox"),m=require("./intelligent-form/intelligent-form-provider.cjs"),Te=require("@radix-ui/react-scroll-area"),p=require("../atoms/icons/built-in-icon-renderer.cjs"),c=require("../utils/misc.cjs"),Be=require("react-hook-form"),I=require("../providers/intelligent-form-field-provider.cjs"),He=require("../atoms/icons/checkbox-icon.cjs"),x=require("../providers/config-provider.cjs"),h=require("../providers/source-item-provider.cjs"),Ee=require("../atoms/link.cjs"),Le=require("../atoms/markdown/index.cjs"),S=require("../utils/compose-refs.cjs"),u=require("../utils/compose-event-handlers.cjs");function k(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const n in i)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>i[n]})}}return e.default=i,Object.freeze(e)}const g=k(je),R=k(Ae),P=k(Te),Ve=t.ikp("form",{_id:"intelligentForm__Root"}),w=i=>{const{onSubmit:e,...n}=i,{handleSubmit:r}=m.useIntelligentForm();return o.jsx(Ve,{onSubmit:u.composeEventHandlers(e,r),...n})},j=t.ikp("h2",{_id:"intelligentForm__Heading",children:"Contact Support"}),A=t.ikp("div",{_id:"intelligentForm__Content"}),T=t.ikp(P.Root,{_id:"intelligentForm__Content__ScrollArea"}),qe=t.ikp(P.Viewport,{_id:"intelligentForm__Content__ScrollAreaViewport"}),B=i=>{const{children:e,...n}=i;return o.jsx(qe,{children:o.jsx("div",{"data-part":"grid",style:{display:"grid"},children:e}),...n})},H=t.ikp(P.ScrollAreaScrollbar,{_id:"intelligentForm__Content__ScrollAreaScrollbar"}),E=t.ikp(P.ScrollAreaThumb,{_id:"intelligentForm__Content__ScrollAreaThumb"}),L=t.ikp(P.Corner,{_id:"intelligentForm__Content__ScrollAreaCorner"}),De=t.ikp("div",{_id:"intelligentForm__Success"}),V=i=>{const{children:e,...n}=i,{isSubmitSuccessful:r}=m.useIntelligentForm();return r?o.jsx(De,{...n,children:e}):null},Ne=t.ikp(p.BuiltInIconRenderer,{_id:"intelligentForm__SuccessIcon"}),q=i=>{const{formConfig:{successView:e}}=m.useIntelligentForm();return o.jsx(Ne,{iconSettings:e.icon??{builtIn:"LuCircleCheck"},...i})},Oe=t.ikp("h2",{_id:"intelligentForm__SuccessHeading"}),D=i=>{const{formConfig:{successView:e}}=m.useIntelligentForm();return o.jsx(Oe,{children:e.heading,...i})},Me=t.ikp("p",{_id:"intelligentForm__SuccessMessage"}),N=i=>{const{formConfig:{successView:e}}=m.useIntelligentForm();return o.jsx(Me,{children:e.message,...i})},O=t.ikp("div",{_id:"intelligentForm__PrimaryForm"}),ze=t.ikp("div",{_id:"intelligentForm__PrimaryFormFields"}),Ue=t.ikp("p",{_id:"intelligentForm__PrimaryForm__Description"}),M=i=>{const{formConfig:{primary:e}}=m.useIntelligentForm();return e.description?o.jsx(Ue,{children:e.description,...i}):null},z=i=>{const{children:e,...n}=i,{formConfig:{primary:r}}=m.useIntelligentForm();return o.jsx(ze,{children:c.maybeRender(e,r.fields),...n})},Qe=t.ikp("button",{_id:"intelligentForm__PrimaryFormSubmit",type:"button",children:"Next"}),U=i=>{const{onClick:e,...n}=i,{submittedPrimaryForm:r,handleSubmitPrimaryForm:l}=m.useIntelligentForm();return o.jsx(Qe,{"data-submitted":c.dataAttr(r),onClick:u.composeEventHandlers(e,l),...n})},We=t.ikp("div",{_id:"intelligentForm__Field"}),Q=i=>{const{field:e,autoFocus:n,...r}=i,{control:l,errors:s}=m.useIntelligentForm();return o.jsx(Be.Controller,{name:e.name,control:l,rules:{required:e.isRequired?`${e.label} is required.`:void 0},render:({field:d})=>{const a=d.value!==void 0||e.inputType==="file";return o.jsx(I.IntelligentFormFieldProvider,{"data-invalid":c.dataAttr(!!s[e.name]),field:e,fieldProps:d,autoFocus:n,children:a&&o.jsx(We,{"data-input-type":e.inputType,"data-hidden":c.dataAttr(e.isHidden),...r})})}})},$e=t.ikp("label",{_id:"intelligentForm__FieldLabel"}),W=i=>{const{field:e}=I.useIntelligentFormField();return o.jsx($e,{"data-required":c.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...i})},Ge=t.ikp("input",{_id:"intelligentForm__FieldText",type:"text"}),f=F.forwardRef((i,e)=>{const{field:n,error:r,fieldProps:{onChange:l,onBlur:s,ref:d,...a},autoFocus:v}=I.useIntelligentFormField(),_=S.useComposedRefs(e,d);return o.jsx(Ge,{asChild:n.inputType==="textarea",ref:_,id:n.name,autoFocus:v,placeholder:"placeholder"in n?n.placeholder:void 0,"data-invalid":c.dataAttr(!!r),onChange:u.composeEventHandlers(i.onChange,l),onBlur:u.composeEventHandlers(i.onBlur,s),...a,...i,children:n.inputType==="textarea"?o.jsx(y,{minRows:3,maxRows:10}):null})}),$=t.ikp(f,{_id:"intelligentForm__FieldEmail",type:"email"}),Je=t.ikp("input",{_id:"intelligentForm__FieldFile",type:"file",multiple:!0}),G=i=>{const{field:e,error:n,fieldProps:{value:r,onChange:l,onBlur:s,...d},autoFocus:a}=I.useIntelligentFormField(),{onChange:v,onBlur:_,...b}=i,C=Re=>{const we=Re.target.files;l(we)};return o.jsx(Je,{id:e.name,autoFocus:a,"data-value":r,"data-invalid":c.dataAttr(!!n),...b,...d,onChange:u.composeEventHandlers(v,C),onBlur:u.composeEventHandlers(_,s)})},J=t.ikp(f,{_id:"intelligentForm__FieldTextArea",type:"textarea",asChild:!0,children:o.jsx(y,{rows:1,maxRows:8})}),Ke=t.ikp(R.Root,{_id:"intelligentForm__FieldCheckbox"}),K=i=>{const{field:e,error:n,fieldProps:r,autoFocus:l}=I.useIntelligentFormField(),{onCheckedChange:s,...d}=i;return o.jsx(Ke,{id:e.name,name:e.name,autoFocus:l,"data-invalid":c.dataAttr(!!n),checked:r.value,onCheckedChange:u.composeEventHandlers(s,r.onChange),...d})},X=t.ikp(R.Indicator,{_id:"intelligentForm__FieldCheckboxIndicator",children:o.jsx(He.CheckboxIcon,{})}),Xe=t.ikp(g.Root,{_id:"intelligentForm__FieldSelect"}),Y=i=>{const{field:e,error:n,fieldProps:r}=I.useIntelligentFormField(),{onValueChange:l,...s}=i;return o.jsx(Xe,{name:e.name,"data-invalid":c.dataAttr(!!n),value:r.value,onValueChange:u.composeEventHandlers(l,r.onChange),...s})},Z=t.ikp(g.Trigger,{_id:"intelligentForm__FieldSelect__Trigger"}),Ye=t.ikp(g.Value,{_id:"intelligentForm__FieldSelect__Value"}),ee=i=>{const{field:e}=I.useIntelligentFormField();return o.jsx(Ye,{placeholder:"placeholder"in e?e.placeholder:void 0,...i})},ie=t.ikp(g.Icon,{_id:"intelligentForm__FieldSelect__Icon",asChild:!0,children:o.jsx(p.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),te=t.ikp(g.Content,{_id:"intelligentForm__FieldSelect__Content",position:"popper"}),ne=t.ikp(g.Viewport,{_id:"intelligentForm__FieldSelect__Viewport"}),re=t.ikp(g.Item,{_id:"intelligentForm__FieldSelect__Item"}),oe=t.ikp(g.ItemText,{_id:"intelligentForm__FieldSelect__ItemText"}),le=t.ikp(g.ItemIndicator,{_id:"intelligentForm__FieldSelect__ItemIndicator",asChild:!0,children:o.jsx(p.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),Ze=t.ikp("span",{_id:"intelligentForm__FieldError"}),me=i=>{const{error:e}=I.useIntelligentFormField();return e?o.jsx(Ze,{children:e.message?.toString(),...i}):null},se=t.ikp("div",{_id:"intelligentForm__BotHeading"}),ce=t.ikp(p.BuiltInIconRenderer,{_id:"intelligentForm__BotHeading__Icon",iconSettings:{builtIn:"LuSparkles"}}),ei=t.ikp("div",{_id:"intelligentForm__BotHeading__Name"}),de=i=>{const{baseSettings:e}=x.useInkeepConfig(),{organizationDisplayName:n}=e??{},{formConfig:{aiAssistantName:r}}=m.useIntelligentForm();return o.jsx(ei,{children:r??n,...i})},ii=t.ikp("div",{_id:"intelligentForm__Loading"}),Fe=F.forwardRef(({...i},e)=>{const{loading:n}=m.useIntelligentForm(),r=F.useRef(null),l=S.useComposedRefs(e,r);return F.useEffect(()=>{n&&r.current&&r.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[n]),n?o.jsx(ii,{ref:l,...i}):null}),ti=t.ikp("div",{_id:"intelligentForm__ConfidentResponse"}),ae=F.forwardRef(({...i},e)=>{const{aiResponse:n,loading:r}=m.useIntelligentForm(),l=F.useRef(null),s=S.useComposedRefs(e,l);return F.useEffect(()=>{!r&&n.answerConfidence&&l.current&&l.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[r,n.answerConfidence]),n.answerConfidence?o.jsx(ti,{ref:s,...i}):null}),ni=t.ikp(Le.Markdown,{_id:"intelligentForm__ConfidentAnswer"}),ue=i=>{const{aiResponse:e}=m.useIntelligentForm();return o.jsx(ni,{shouldOpenLinksInNewTab:!0,children:e.answer,...i})},ri=t.ikp("button",{_id:"intelligentForm__ConfidentResponseButton",type:"button"}),ge=i=>{const{onClick:e,...n}=i,{showSecondaryFields:r,setShowSecondaryFields:l}=m.useIntelligentForm(),s=()=>{l(!0)};return o.jsx(ri,{"data-escalated":c.dataAttr(r),onClick:u.composeEventHandlers(e,s),...n})},Ie=t.ikp(p.BuiltInIconRenderer,{_id:"intelligentForm__ConfidentResponseButton__Icon",iconSettings:{builtIn:"LuUser"}}),_e=t.ikp("span",{_id:"intelligentForm__ConfidentResponseButton__Label",children:"Escalate to human"}),oi=t.ikp("div",{_id:"intelligentForm__SecondaryForm"}),pe=F.forwardRef(({...i},e)=>{const{showSecondaryFields:n}=m.useIntelligentForm(),r=F.useRef(null),l=S.useComposedRefs(e,r);return F.useEffect(()=>{n&&r.current&&r.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[n]),n?o.jsx(oi,{ref:l,...i}):null}),li=t.ikp("p",{_id:"intelligentForm__SecondaryForm__Description"}),ve=i=>{const{formConfig:{secondary:e},aiResponse:{answerConfidence:n}}=m.useIntelligentForm();if(!e.description)return null;const r=typeof e.description=="string"?e.description:n?e.description.confident:e.description.default;return o.jsx(li,{children:r,...i})},mi=t.ikp("div",{_id:"intelligentForm__SecondaryFormFields"}),Pe=i=>{const{children:e,...n}=i,{formConfig:{secondary:r}}=m.useIntelligentForm();return o.jsx(mi,{children:c.maybeRender(e,r.fields),...n})},Se=t.ikp("button",{_id:"intelligentForm__SecondaryFormSubmit",type:"submit",children:"Submit"}),si=t.ikp("span",{_id:"intelligentForm__Error"}),fe=i=>{const{formError:e}=m.useIntelligentForm();return e?o.jsx(si,{children:e.message,...i}):null},Ce=t.ikp("div",{_id:"intelligentForm__Sources"}),he=t.ikp("p",{_id:"intelligentForm__SourcesCaption",children:"Here are the sources I considered:"}),ci=t.ikp("div",{_id:"intelligentForm__SourcesList"}),ke=i=>{const{children:e,...n}=i,{baseSettings:{transformSource:r,organizationDisplayName:l}}=x.useInkeepConfig(),{aiResponse:{recordsConsidered:s}}=m.useIntelligentForm();if(!s)return null;const d=s.reduce((a,v)=>{const _=r(v,"intelligentFormSource",{organizationDisplayName:l});return a.some(C=>C.url===_.url)||a.push(_),a},[]);return o.jsx(ci,{children:c.maybeRender(e,d),...n})},di=t.ikp(Ee.LinkWithQueryParams,{_id:"intelligentForm__Source"}),be=i=>{const{source:e,...n}=i;return o.jsx(h.SourceItemProvider,{source:{...e,isExternal:!!e.shouldOpenInNewTab},children:o.jsx(di,{"data-type":e.type,appendToUrl:e.appendToUrl,href:e.url,isExternal:e.shouldOpenInNewTab!==!1,...n})})},Fi=t.ikp(p.BuiltInIconRenderer,{_id:"intelligentForm__SourceIcon"}),ye=i=>{const{source:e}=h.useSourceItem();return o.jsx(Fi,{iconSettings:e.icon,"data-type":e.type,...i})},ai=t.ikp("span",{_id:"intelligentForm__SourceTitle"}),xe=i=>{const{source:e}=h.useSourceItem();return o.jsx(ai,{"data-type":e.type,children:e.title,...i})};exports.Provider=m.IntelligentFormProvider;exports.BotHeading=se;exports.BotHeadingIcon=ce;exports.BotHeadingName=de;exports.ConfidentAnswer=ue;exports.ConfidentResponse=ae;exports.ConfidentResponseButton=ge;exports.ConfidentResponseButtonIcon=Ie;exports.ConfidentResponseButtonLabel=_e;exports.Content=A;exports.ContentScrollArea=T;exports.ContentScrollAreaCorner=L;exports.ContentScrollAreaScrollbar=H;exports.ContentScrollAreaThumb=E;exports.ContentScrollAreaViewport=B;exports.Error=fe;exports.FormField=Q;exports.FormFieldCheckbox=K;exports.FormFieldCheckboxIndicator=X;exports.FormFieldEmail=$;exports.FormFieldError=me;exports.FormFieldFile=G;exports.FormFieldLabel=W;exports.FormFieldSelect=Y;exports.FormFieldSelectContent=te;exports.FormFieldSelectIcon=ie;exports.FormFieldSelectItem=re;exports.FormFieldSelectItemIndicator=le;exports.FormFieldSelectItemText=oe;exports.FormFieldSelectTrigger=Z;exports.FormFieldSelectValue=ee;exports.FormFieldSelectViewport=ne;exports.FormFieldText=f;exports.FormFieldTextArea=J;exports.Heading=j;exports.IntelligentFormPrimitiveBotHeading=se;exports.IntelligentFormPrimitiveBotHeadingIcon=ce;exports.IntelligentFormPrimitiveBotHeadingName=de;exports.IntelligentFormPrimitiveConfidentAnswer=ue;exports.IntelligentFormPrimitiveConfidentResponse=ae;exports.IntelligentFormPrimitiveConfidentResponseButton=ge;exports.IntelligentFormPrimitiveConfidentResponseButtonIcon=Ie;exports.IntelligentFormPrimitiveConfidentResponseButtonLabel=_e;exports.IntelligentFormPrimitiveContent=A;exports.IntelligentFormPrimitiveContentScrollArea=T;exports.IntelligentFormPrimitiveContentScrollAreaCorner=L;exports.IntelligentFormPrimitiveContentScrollAreaScrollbar=H;exports.IntelligentFormPrimitiveContentScrollAreaThumb=E;exports.IntelligentFormPrimitiveContentScrollAreaViewport=B;exports.IntelligentFormPrimitiveFormError=fe;exports.IntelligentFormPrimitiveFormField=Q;exports.IntelligentFormPrimitiveFormFieldCheckbox=K;exports.IntelligentFormPrimitiveFormFieldCheckboxIndicator=X;exports.IntelligentFormPrimitiveFormFieldEmail=$;exports.IntelligentFormPrimitiveFormFieldError=me;exports.IntelligentFormPrimitiveFormFieldFile=G;exports.IntelligentFormPrimitiveFormFieldLabel=W;exports.IntelligentFormPrimitiveFormFieldSelect=Y;exports.IntelligentFormPrimitiveFormFieldSelectContent=te;exports.IntelligentFormPrimitiveFormFieldSelectIcon=ie;exports.IntelligentFormPrimitiveFormFieldSelectItem=re;exports.IntelligentFormPrimitiveFormFieldSelectItemIndicator=le;exports.IntelligentFormPrimitiveFormFieldSelectItemText=oe;exports.IntelligentFormPrimitiveFormFieldSelectTrigger=Z;exports.IntelligentFormPrimitiveFormFieldSelectValue=ee;exports.IntelligentFormPrimitiveFormFieldSelectViewport=ne;exports.IntelligentFormPrimitiveFormFieldText=f;exports.IntelligentFormPrimitiveFormFieldTextArea=J;exports.IntelligentFormPrimitiveHeading=j;exports.IntelligentFormPrimitiveLoading=Fe;exports.IntelligentFormPrimitivePrimaryForm=O;exports.IntelligentFormPrimitivePrimaryFormDescription=M;exports.IntelligentFormPrimitivePrimaryFormFields=z;exports.IntelligentFormPrimitivePrimaryFormSubmit=U;exports.IntelligentFormPrimitiveRoot=w;exports.IntelligentFormPrimitiveSecondaryForm=pe;exports.IntelligentFormPrimitiveSecondaryFormDescription=ve;exports.IntelligentFormPrimitiveSecondaryFormFields=Pe;exports.IntelligentFormPrimitiveSecondaryFormSubmit=Se;exports.IntelligentFormPrimitiveSource=be;exports.IntelligentFormPrimitiveSourceIcon=ye;exports.IntelligentFormPrimitiveSourceTitle=xe;exports.IntelligentFormPrimitiveSources=Ce;exports.IntelligentFormPrimitiveSourcesCaption=he;exports.IntelligentFormPrimitiveSourcesList=ke;exports.IntelligentFormPrimitiveSuccess=V;exports.IntelligentFormPrimitiveSuccessHeading=D;exports.IntelligentFormPrimitiveSuccessIcon=q;exports.IntelligentFormPrimitiveSuccessMessage=N;exports.Loading=Fe;exports.PrimaryForm=O;exports.PrimaryFormDescription=M;exports.PrimaryFormFields=z;exports.PrimaryFormSubmit=U;exports.Root=w;exports.SecondaryForm=pe;exports.SecondaryFormDescription=ve;exports.SecondaryFormFields=Pe;exports.SecondaryFormSubmit=Se;exports.Source=be;exports.SourceIcon=ye;exports.SourceTitle=xe;exports.Sources=Ce;exports.SourcesCaption=he;exports.SourcesList=ke;exports.Success=V;exports.SuccessHeading=D;exports.SuccessIcon=q;exports.SuccessMessage=N;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),n=require("./factory.cjs"),F=require("react"),y=require("react-textarea-autosize"),je=require("@radix-ui/react-select"),Ae=require("@radix-ui/react-checkbox"),m=require("./intelligent-form/intelligent-form-provider.cjs"),Te=require("@radix-ui/react-scroll-area"),p=require("../atoms/icons/built-in-icon-renderer.cjs"),c=require("../utils/misc.cjs"),Be=require("react-hook-form"),I=require("../providers/intelligent-form-field-provider.cjs"),He=require("../atoms/icons/checkbox-icon.cjs"),x=require("../providers/config-provider.cjs"),h=require("../providers/source-item-provider.cjs"),Ee=require("../atoms/link.cjs"),Le=require("../atoms/markdown/index.cjs"),P=require("../utils/compose-refs.cjs"),u=require("../utils/compose-event-handlers.cjs");function b(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const g=b(je),R=b(Ae),S=b(Te),Ve=n.ikp("form",{_id:"intelligentForm__Root"}),w=i=>{const{onSubmit:e,...t}=i,{handleSubmit:r}=m.useIntelligentForm();return o.jsx(Ve,{onSubmit:u.composeEventHandlers(e,r),...t})},j=n.ikp("h2",{_id:"intelligentForm__Heading",children:"Contact Support"}),A=n.ikp("div",{_id:"intelligentForm__Content"}),T=n.ikp(S.Root,{_id:"intelligentForm__Content__ScrollArea"}),qe=n.ikp(S.Viewport,{_id:"intelligentForm__Content__ScrollAreaViewport"}),B=i=>{const{children:e,...t}=i;return o.jsx(qe,{children:o.jsx("div",{"data-part":"grid",style:{display:"grid"},children:e}),...t})},H=n.ikp(S.ScrollAreaScrollbar,{_id:"intelligentForm__Content__ScrollAreaScrollbar"}),E=n.ikp(S.ScrollAreaThumb,{_id:"intelligentForm__Content__ScrollAreaThumb"}),L=n.ikp(S.Corner,{_id:"intelligentForm__Content__ScrollAreaCorner"}),De=n.ikp("div",{_id:"intelligentForm__Success"}),V=i=>{const{children:e,...t}=i,{isSubmitSuccessful:r}=m.useIntelligentForm();return r?o.jsx(De,{...t,children:e}):null},Ne=n.ikp(p.BuiltInIconRenderer,{_id:"intelligentForm__SuccessIcon"}),q=i=>{const{formSettings:{successView:e}}=m.useIntelligentForm();return o.jsx(Ne,{iconSettings:e.icon??{builtIn:"LuCircleCheck"},...i})},Oe=n.ikp("h2",{_id:"intelligentForm__SuccessHeading"}),D=i=>{const{formSettings:{successView:e}}=m.useIntelligentForm();return o.jsx(Oe,{children:e.heading,...i})},Me=n.ikp("p",{_id:"intelligentForm__SuccessMessage"}),N=i=>{const{formSettings:{successView:e}}=m.useIntelligentForm();return o.jsx(Me,{children:e.message,...i})},O=n.ikp("div",{_id:"intelligentForm__PrimaryForm"}),ze=n.ikp("div",{_id:"intelligentForm__PrimaryFormFields"}),Ue=n.ikp("p",{_id:"intelligentForm__PrimaryForm__Description"}),M=i=>{const{formSettings:{primary:e}}=m.useIntelligentForm();return e.description?o.jsx(Ue,{children:e.description,...i}):null},z=i=>{const{children:e,...t}=i,{formSettings:{primary:r}}=m.useIntelligentForm();return o.jsx(ze,{children:c.maybeRender(e,r.fields),...t})},Qe=n.ikp("button",{_id:"intelligentForm__PrimaryFormSubmit",type:"button",children:"Next"}),U=i=>{const{onClick:e,...t}=i,{submittedPrimaryForm:r,handleSubmitPrimaryForm:l}=m.useIntelligentForm();return o.jsx(Qe,{"data-submitted":c.dataAttr(r),onClick:u.composeEventHandlers(e,l),...t})},We=n.ikp("div",{_id:"intelligentForm__Field"}),Q=i=>{const{field:e,autoFocus:t,...r}=i,{control:l,errors:s}=m.useIntelligentForm();return o.jsx(Be.Controller,{name:e.name,control:l,rules:{required:e.isRequired?`${e.label} is required.`:void 0},render:({field:d})=>{const a=d.value!==void 0||e.inputType==="file";return o.jsx(I.IntelligentFormFieldProvider,{"data-invalid":c.dataAttr(!!s[e.name]),field:e,fieldProps:d,autoFocus:t,children:a&&o.jsx(We,{"data-input-type":e.inputType,"data-hidden":c.dataAttr(e.isHidden),...r})})}})},$e=n.ikp("label",{_id:"intelligentForm__FieldLabel"}),W=i=>{const{field:e}=I.useIntelligentFormField();return o.jsx($e,{"data-required":c.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...i})},Ge=n.ikp("input",{_id:"intelligentForm__FieldText",type:"text"}),f=F.forwardRef((i,e)=>{const{field:t,error:r,fieldProps:{onChange:l,onBlur:s,ref:d,...a},autoFocus:v}=I.useIntelligentFormField(),_=P.useComposedRefs(e,d);return o.jsx(Ge,{asChild:t.inputType==="textarea",ref:_,id:t.name,autoFocus:v,placeholder:"placeholder"in t?t.placeholder:void 0,"data-invalid":c.dataAttr(!!r),onChange:u.composeEventHandlers(i.onChange,l),onBlur:u.composeEventHandlers(i.onBlur,s),...a,...i,children:t.inputType==="textarea"?o.jsx(y,{minRows:3,maxRows:10}):null})}),$=n.ikp(f,{_id:"intelligentForm__FieldEmail",type:"email"}),Je=n.ikp("input",{_id:"intelligentForm__FieldFile",type:"file",multiple:!0}),G=i=>{const{field:e,error:t,fieldProps:{value:r,onChange:l,onBlur:s,...d},autoFocus:a}=I.useIntelligentFormField(),{onChange:v,onBlur:_,...k}=i,C=Re=>{const we=Re.target.files;l(we)};return o.jsx(Je,{id:e.name,autoFocus:a,"data-value":r,"data-invalid":c.dataAttr(!!t),...k,...d,onChange:u.composeEventHandlers(v,C),onBlur:u.composeEventHandlers(_,s)})},J=n.ikp(f,{_id:"intelligentForm__FieldTextArea",type:"textarea",asChild:!0,children:o.jsx(y,{rows:1,maxRows:8})}),Ke=n.ikp(R.Root,{_id:"intelligentForm__FieldCheckbox"}),K=i=>{const{field:e,error:t,fieldProps:r,autoFocus:l}=I.useIntelligentFormField(),{onCheckedChange:s,...d}=i;return o.jsx(Ke,{id:e.name,name:e.name,autoFocus:l,"data-invalid":c.dataAttr(!!t),checked:r.value,onCheckedChange:u.composeEventHandlers(s,r.onChange),...d})},X=n.ikp(R.Indicator,{_id:"intelligentForm__FieldCheckboxIndicator",children:o.jsx(He.CheckboxIcon,{})}),Xe=n.ikp(g.Root,{_id:"intelligentForm__FieldSelect"}),Y=i=>{const{field:e,error:t,fieldProps:r}=I.useIntelligentFormField(),{onValueChange:l,...s}=i;return o.jsx(Xe,{name:e.name,"data-invalid":c.dataAttr(!!t),value:r.value,onValueChange:u.composeEventHandlers(l,r.onChange),...s})},Z=n.ikp(g.Trigger,{_id:"intelligentForm__FieldSelect__Trigger"}),Ye=n.ikp(g.Value,{_id:"intelligentForm__FieldSelect__Value"}),ee=i=>{const{field:e}=I.useIntelligentFormField();return o.jsx(Ye,{placeholder:"placeholder"in e?e.placeholder:void 0,...i})},ie=n.ikp(g.Icon,{_id:"intelligentForm__FieldSelect__Icon",asChild:!0,children:o.jsx(p.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),te=n.ikp(g.Content,{_id:"intelligentForm__FieldSelect__Content",position:"popper"}),ne=n.ikp(g.Viewport,{_id:"intelligentForm__FieldSelect__Viewport"}),re=n.ikp(g.Item,{_id:"intelligentForm__FieldSelect__Item"}),oe=n.ikp(g.ItemText,{_id:"intelligentForm__FieldSelect__ItemText"}),le=n.ikp(g.ItemIndicator,{_id:"intelligentForm__FieldSelect__ItemIndicator",asChild:!0,children:o.jsx(p.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),Ze=n.ikp("span",{_id:"intelligentForm__FieldError"}),me=i=>{const{error:e}=I.useIntelligentFormField();return e?o.jsx(Ze,{children:e.message?.toString(),...i}):null},se=n.ikp("div",{_id:"intelligentForm__BotHeading"}),ce=n.ikp(p.BuiltInIconRenderer,{_id:"intelligentForm__BotHeading__Icon",iconSettings:{builtIn:"LuSparkles"}}),ei=n.ikp("div",{_id:"intelligentForm__BotHeading__Name"}),de=i=>{const{baseSettings:e}=x.useInkeepConfig(),{organizationDisplayName:t}=e??{},{formSettings:{aiAssistantName:r}}=m.useIntelligentForm();return o.jsx(ei,{children:r??t,...i})},ii=n.ikp("div",{_id:"intelligentForm__Loading"}),Fe=F.forwardRef(({...i},e)=>{const{loading:t}=m.useIntelligentForm(),r=F.useRef(null),l=P.useComposedRefs(e,r);return F.useEffect(()=>{t&&r.current&&r.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[t]),t?o.jsx(ii,{ref:l,...i}):null}),ti=n.ikp("div",{_id:"intelligentForm__ConfidentResponse"}),ae=F.forwardRef(({...i},e)=>{const{aiResponse:t,loading:r}=m.useIntelligentForm(),l=F.useRef(null),s=P.useComposedRefs(e,l);return F.useEffect(()=>{!r&&t.answerConfidence&&l.current&&l.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[r,t.answerConfidence]),t.answerConfidence?o.jsx(ti,{ref:s,...i}):null}),ni=n.ikp(Le.Markdown,{_id:"intelligentForm__ConfidentAnswer"}),ue=i=>{const{aiResponse:e}=m.useIntelligentForm();return o.jsx(ni,{shouldOpenLinksInNewTab:!0,children:e.answer,...i})},ri=n.ikp("button",{_id:"intelligentForm__ConfidentResponseButton",type:"button"}),ge=i=>{const{onClick:e,...t}=i,{showSecondaryFields:r,setShowSecondaryFields:l}=m.useIntelligentForm(),s=()=>{l(!0)};return o.jsx(ri,{"data-escalated":c.dataAttr(r),onClick:u.composeEventHandlers(e,s),...t})},Ie=n.ikp(p.BuiltInIconRenderer,{_id:"intelligentForm__ConfidentResponseButton__Icon",iconSettings:{builtIn:"LuUser"}}),_e=n.ikp("span",{_id:"intelligentForm__ConfidentResponseButton__Label",children:"Escalate to human"}),oi=n.ikp("div",{_id:"intelligentForm__SecondaryForm"}),pe=F.forwardRef(({...i},e)=>{const{showSecondaryFields:t}=m.useIntelligentForm(),r=F.useRef(null),l=P.useComposedRefs(e,r);return F.useEffect(()=>{t&&r.current&&r.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[t]),t?o.jsx(oi,{ref:l,...i}):null}),li=n.ikp("p",{_id:"intelligentForm__SecondaryForm__Description"}),ve=i=>{const{formSettings:{secondary:e},aiResponse:{answerConfidence:t}}=m.useIntelligentForm();if(!e.description)return null;const r=typeof e.description=="string"?e.description:t?e.description.confident:e.description.default;return o.jsx(li,{children:r,...i})},mi=n.ikp("div",{_id:"intelligentForm__SecondaryFormFields"}),Se=i=>{const{children:e,...t}=i,{formSettings:{secondary:r}}=m.useIntelligentForm();return o.jsx(mi,{children:c.maybeRender(e,r.fields),...t})},si=n.ikp("button",{_id:"intelligentForm__SecondaryFormSubmit",type:"submit",children:"Submit"}),Pe=i=>{const{formSettings:e}=m.useIntelligentForm(),{label:t}=e.buttons.submit;return o.jsx(si,{children:t??"Submit",...i})},ci=n.ikp("span",{_id:"intelligentForm__Error"}),fe=i=>{const{formError:e}=m.useIntelligentForm();return e?o.jsx(ci,{children:e.message,...i}):null},Ce=n.ikp("div",{_id:"intelligentForm__Sources"}),he=n.ikp("p",{_id:"intelligentForm__SourcesCaption",children:"Here are the sources I considered:"}),di=n.ikp("div",{_id:"intelligentForm__SourcesList"}),be=i=>{const{children:e,...t}=i,{baseSettings:{transformSource:r,organizationDisplayName:l}}=x.useInkeepConfig(),{aiResponse:{recordsConsidered:s}}=m.useIntelligentForm();if(!s)return null;const d=s.reduce((a,v)=>{const _=r(v,"intelligentFormSource",{organizationDisplayName:l});return a.some(C=>C.url===_.url)||a.push(_),a},[]);return o.jsx(di,{children:c.maybeRender(e,d),...t})},Fi=n.ikp(Ee.LinkWithQueryParams,{_id:"intelligentForm__Source"}),ke=i=>{const{source:e,...t}=i;return o.jsx(h.SourceItemProvider,{source:{...e,isExternal:!!e.shouldOpenInNewTab},children:o.jsx(Fi,{"data-type":e.type,appendToUrl:e.appendToUrl,href:e.url,isExternal:e.shouldOpenInNewTab!==!1,...t})})},ai=n.ikp(p.BuiltInIconRenderer,{_id:"intelligentForm__SourceIcon"}),ye=i=>{const{source:e}=h.useSourceItem();return o.jsx(ai,{iconSettings:e.icon,"data-type":e.type,...i})},ui=n.ikp("span",{_id:"intelligentForm__SourceTitle"}),xe=i=>{const{source:e}=h.useSourceItem();return o.jsx(ui,{"data-type":e.type,children:e.title,...i})};exports.Provider=m.IntelligentFormProvider;exports.BotHeading=se;exports.BotHeadingIcon=ce;exports.BotHeadingName=de;exports.ConfidentAnswer=ue;exports.ConfidentResponse=ae;exports.ConfidentResponseButton=ge;exports.ConfidentResponseButtonIcon=Ie;exports.ConfidentResponseButtonLabel=_e;exports.Content=A;exports.ContentScrollArea=T;exports.ContentScrollAreaCorner=L;exports.ContentScrollAreaScrollbar=H;exports.ContentScrollAreaThumb=E;exports.ContentScrollAreaViewport=B;exports.Error=fe;exports.FormField=Q;exports.FormFieldCheckbox=K;exports.FormFieldCheckboxIndicator=X;exports.FormFieldEmail=$;exports.FormFieldError=me;exports.FormFieldFile=G;exports.FormFieldLabel=W;exports.FormFieldSelect=Y;exports.FormFieldSelectContent=te;exports.FormFieldSelectIcon=ie;exports.FormFieldSelectItem=re;exports.FormFieldSelectItemIndicator=le;exports.FormFieldSelectItemText=oe;exports.FormFieldSelectTrigger=Z;exports.FormFieldSelectValue=ee;exports.FormFieldSelectViewport=ne;exports.FormFieldText=f;exports.FormFieldTextArea=J;exports.Heading=j;exports.IntelligentFormPrimitiveBotHeading=se;exports.IntelligentFormPrimitiveBotHeadingIcon=ce;exports.IntelligentFormPrimitiveBotHeadingName=de;exports.IntelligentFormPrimitiveConfidentAnswer=ue;exports.IntelligentFormPrimitiveConfidentResponse=ae;exports.IntelligentFormPrimitiveConfidentResponseButton=ge;exports.IntelligentFormPrimitiveConfidentResponseButtonIcon=Ie;exports.IntelligentFormPrimitiveConfidentResponseButtonLabel=_e;exports.IntelligentFormPrimitiveContent=A;exports.IntelligentFormPrimitiveContentScrollArea=T;exports.IntelligentFormPrimitiveContentScrollAreaCorner=L;exports.IntelligentFormPrimitiveContentScrollAreaScrollbar=H;exports.IntelligentFormPrimitiveContentScrollAreaThumb=E;exports.IntelligentFormPrimitiveContentScrollAreaViewport=B;exports.IntelligentFormPrimitiveFormError=fe;exports.IntelligentFormPrimitiveFormField=Q;exports.IntelligentFormPrimitiveFormFieldCheckbox=K;exports.IntelligentFormPrimitiveFormFieldCheckboxIndicator=X;exports.IntelligentFormPrimitiveFormFieldEmail=$;exports.IntelligentFormPrimitiveFormFieldError=me;exports.IntelligentFormPrimitiveFormFieldFile=G;exports.IntelligentFormPrimitiveFormFieldLabel=W;exports.IntelligentFormPrimitiveFormFieldSelect=Y;exports.IntelligentFormPrimitiveFormFieldSelectContent=te;exports.IntelligentFormPrimitiveFormFieldSelectIcon=ie;exports.IntelligentFormPrimitiveFormFieldSelectItem=re;exports.IntelligentFormPrimitiveFormFieldSelectItemIndicator=le;exports.IntelligentFormPrimitiveFormFieldSelectItemText=oe;exports.IntelligentFormPrimitiveFormFieldSelectTrigger=Z;exports.IntelligentFormPrimitiveFormFieldSelectValue=ee;exports.IntelligentFormPrimitiveFormFieldSelectViewport=ne;exports.IntelligentFormPrimitiveFormFieldText=f;exports.IntelligentFormPrimitiveFormFieldTextArea=J;exports.IntelligentFormPrimitiveHeading=j;exports.IntelligentFormPrimitiveLoading=Fe;exports.IntelligentFormPrimitivePrimaryForm=O;exports.IntelligentFormPrimitivePrimaryFormDescription=M;exports.IntelligentFormPrimitivePrimaryFormFields=z;exports.IntelligentFormPrimitivePrimaryFormSubmit=U;exports.IntelligentFormPrimitiveRoot=w;exports.IntelligentFormPrimitiveSecondaryForm=pe;exports.IntelligentFormPrimitiveSecondaryFormDescription=ve;exports.IntelligentFormPrimitiveSecondaryFormFields=Se;exports.IntelligentFormPrimitiveSecondaryFormSubmit=Pe;exports.IntelligentFormPrimitiveSource=ke;exports.IntelligentFormPrimitiveSourceIcon=ye;exports.IntelligentFormPrimitiveSourceTitle=xe;exports.IntelligentFormPrimitiveSources=Ce;exports.IntelligentFormPrimitiveSourcesCaption=he;exports.IntelligentFormPrimitiveSourcesList=be;exports.IntelligentFormPrimitiveSuccess=V;exports.IntelligentFormPrimitiveSuccessHeading=D;exports.IntelligentFormPrimitiveSuccessIcon=q;exports.IntelligentFormPrimitiveSuccessMessage=N;exports.Loading=Fe;exports.PrimaryForm=O;exports.PrimaryFormDescription=M;exports.PrimaryFormFields=z;exports.PrimaryFormSubmit=U;exports.Root=w;exports.SecondaryForm=pe;exports.SecondaryFormDescription=ve;exports.SecondaryFormFields=Se;exports.SecondaryFormSubmit=Pe;exports.Source=ke;exports.SourceIcon=ye;exports.SourceTitle=xe;exports.Sources=Ce;exports.SourcesCaption=he;exports.SourcesList=be;exports.Success=V;exports.SuccessHeading=D;exports.SuccessIcon=q;exports.SuccessMessage=N;
|
|
@@ -40,7 +40,7 @@ export interface IntelligentFormPrimitivePrimaryFormFieldsProps extends Omit<Com
|
|
|
40
40
|
children: React.ReactNode | ((fields: FormField[]) => React.ReactNode);
|
|
41
41
|
}
|
|
42
42
|
export declare const IntelligentFormPrimitivePrimaryFormFields: (props: IntelligentFormPrimitivePrimaryFormFieldsProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
-
declare const PrimitivePrimaryFormSubmit: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "
|
|
43
|
+
declare const PrimitivePrimaryFormSubmit: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type" | "_id"> & Partial<Pick< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type" | "_id">>>;
|
|
44
44
|
export declare const IntelligentFormPrimitivePrimaryFormSubmit: (props: ComponentPropsWithRef<typeof PrimitivePrimaryFormSubmit>) => import("react/jsx-runtime").JSX.Element;
|
|
45
45
|
declare const PrimitiveFormField: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
|
|
46
46
|
export interface IntelligentFormPrimitiveFormFieldProps extends ComponentPropsWithRef<typeof PrimitiveFormField> {
|
|
@@ -53,7 +53,7 @@ export declare const IntelligentFormPrimitiveFormFieldText: ForwardRefExoticComp
|
|
|
53
53
|
export declare const IntelligentFormPrimitiveFormFieldEmail: ForwardRefExoticComponent< PolymorphicProps & Omit<Omit< PolymorphicProps & Omit< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id"> & Partial<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id">>, "ref"> & RefAttributes<HTMLTextAreaElement | HTMLInputElement>, "type" | "_id"> & Partial<Pick<Omit< PolymorphicProps & Omit< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id"> & Partial<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id">>, "ref"> & RefAttributes<HTMLTextAreaElement | HTMLInputElement>, "type" | "_id">>>;
|
|
54
54
|
declare const PrimitiveFormFieldFile: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "multiple" | "_id"> & Partial<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "multiple" | "_id">>>;
|
|
55
55
|
export declare const IntelligentFormPrimitiveFormFieldFile: (props: ComponentPropsWithRef<typeof PrimitiveFormFieldFile>) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
-
export declare const IntelligentFormPrimitiveFormFieldTextArea: ForwardRefExoticComponent< PolymorphicProps & Omit<Omit< PolymorphicProps & Omit< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id"> & Partial<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id">>, "ref"> & RefAttributes<HTMLTextAreaElement | HTMLInputElement>, "
|
|
56
|
+
export declare const IntelligentFormPrimitiveFormFieldTextArea: ForwardRefExoticComponent< PolymorphicProps & Omit<Omit< PolymorphicProps & Omit< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id"> & Partial<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id">>, "ref"> & RefAttributes<HTMLTextAreaElement | HTMLInputElement>, "children" | "type" | "asChild" | "_id"> & Partial<Pick<Omit< PolymorphicProps & Omit< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id"> & Partial<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id">>, "ref"> & RefAttributes<HTMLTextAreaElement | HTMLInputElement>, "children" | "type" | "asChild" | "_id">>>;
|
|
57
57
|
declare const PrimitiveFormFieldCheckbox: ForwardRefExoticComponent< PolymorphicProps & Omit<CheckboxPrimitive.CheckboxProps & RefAttributes<HTMLButtonElement>, "_id"> & Partial<Pick<CheckboxPrimitive.CheckboxProps & RefAttributes<HTMLButtonElement>, "_id">>>;
|
|
58
58
|
export declare const IntelligentFormPrimitiveFormFieldCheckbox: (props: ComponentPropsWithRef<typeof PrimitiveFormFieldCheckbox>) => import("react/jsx-runtime").JSX.Element;
|
|
59
59
|
export declare const IntelligentFormPrimitiveFormFieldCheckboxIndicator: ForwardRefExoticComponent< PolymorphicProps & Omit<CheckboxPrimitive.CheckboxIndicatorProps & RefAttributes<HTMLSpanElement>, "children" | "_id"> & Partial<Pick<CheckboxPrimitive.CheckboxIndicatorProps & RefAttributes<HTMLSpanElement>, "children" | "_id">>>;
|
|
@@ -102,7 +102,8 @@ export interface IntelligentFormPrimitiveSecondaryFormFieldsProps extends Omit<C
|
|
|
102
102
|
children: React.ReactNode | ((fields: FormField[]) => React.ReactNode);
|
|
103
103
|
}
|
|
104
104
|
export declare const IntelligentFormPrimitiveSecondaryFormFields: (props: IntelligentFormPrimitiveSecondaryFormFieldsProps) => import("react/jsx-runtime").JSX.Element;
|
|
105
|
-
|
|
105
|
+
declare const PrimitiveSecondaryFormSubmit: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type" | "_id"> & Partial<Pick< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type" | "_id">>>;
|
|
106
|
+
export declare const IntelligentFormPrimitiveSecondaryFormSubmit: (props: ComponentPropsWithRef<typeof PrimitiveSecondaryFormSubmit>) => import("react/jsx-runtime").JSX.Element;
|
|
106
107
|
declare const PrimitiveFormError: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id">>>;
|
|
107
108
|
export declare const IntelligentFormPrimitiveFormError: (props: ComponentPropsWithRef<typeof PrimitiveFormError>) => import("react/jsx-runtime").JSX.Element | null;
|
|
108
109
|
export declare const IntelligentFormPrimitiveSources: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
|
|
@@ -40,7 +40,7 @@ export interface IntelligentFormPrimitivePrimaryFormFieldsProps extends Omit<Com
|
|
|
40
40
|
children: React.ReactNode | ((fields: FormField[]) => React.ReactNode);
|
|
41
41
|
}
|
|
42
42
|
export declare const IntelligentFormPrimitivePrimaryFormFields: (props: IntelligentFormPrimitivePrimaryFormFieldsProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
-
declare const PrimitivePrimaryFormSubmit: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "
|
|
43
|
+
declare const PrimitivePrimaryFormSubmit: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type" | "_id"> & Partial<Pick< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type" | "_id">>>;
|
|
44
44
|
export declare const IntelligentFormPrimitivePrimaryFormSubmit: (props: ComponentPropsWithRef<typeof PrimitivePrimaryFormSubmit>) => import("react/jsx-runtime").JSX.Element;
|
|
45
45
|
declare const PrimitiveFormField: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
|
|
46
46
|
export interface IntelligentFormPrimitiveFormFieldProps extends ComponentPropsWithRef<typeof PrimitiveFormField> {
|
|
@@ -53,7 +53,7 @@ export declare const IntelligentFormPrimitiveFormFieldText: ForwardRefExoticComp
|
|
|
53
53
|
export declare const IntelligentFormPrimitiveFormFieldEmail: ForwardRefExoticComponent< PolymorphicProps & Omit<Omit< PolymorphicProps & Omit< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id"> & Partial<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id">>, "ref"> & RefAttributes<HTMLTextAreaElement | HTMLInputElement>, "type" | "_id"> & Partial<Pick<Omit< PolymorphicProps & Omit< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id"> & Partial<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id">>, "ref"> & RefAttributes<HTMLTextAreaElement | HTMLInputElement>, "type" | "_id">>>;
|
|
54
54
|
declare const PrimitiveFormFieldFile: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "multiple" | "_id"> & Partial<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "multiple" | "_id">>>;
|
|
55
55
|
export declare const IntelligentFormPrimitiveFormFieldFile: (props: ComponentPropsWithRef<typeof PrimitiveFormFieldFile>) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
-
export declare const IntelligentFormPrimitiveFormFieldTextArea: ForwardRefExoticComponent< PolymorphicProps & Omit<Omit< PolymorphicProps & Omit< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id"> & Partial<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id">>, "ref"> & RefAttributes<HTMLTextAreaElement | HTMLInputElement>, "
|
|
56
|
+
export declare const IntelligentFormPrimitiveFormFieldTextArea: ForwardRefExoticComponent< PolymorphicProps & Omit<Omit< PolymorphicProps & Omit< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id"> & Partial<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id">>, "ref"> & RefAttributes<HTMLTextAreaElement | HTMLInputElement>, "children" | "type" | "asChild" | "_id"> & Partial<Pick<Omit< PolymorphicProps & Omit< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id"> & Partial<Pick< DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "_id">>, "ref"> & RefAttributes<HTMLTextAreaElement | HTMLInputElement>, "children" | "type" | "asChild" | "_id">>>;
|
|
57
57
|
declare const PrimitiveFormFieldCheckbox: ForwardRefExoticComponent< PolymorphicProps & Omit<CheckboxPrimitive.CheckboxProps & RefAttributes<HTMLButtonElement>, "_id"> & Partial<Pick<CheckboxPrimitive.CheckboxProps & RefAttributes<HTMLButtonElement>, "_id">>>;
|
|
58
58
|
export declare const IntelligentFormPrimitiveFormFieldCheckbox: (props: ComponentPropsWithRef<typeof PrimitiveFormFieldCheckbox>) => import("react/jsx-runtime").JSX.Element;
|
|
59
59
|
export declare const IntelligentFormPrimitiveFormFieldCheckboxIndicator: ForwardRefExoticComponent< PolymorphicProps & Omit<CheckboxPrimitive.CheckboxIndicatorProps & RefAttributes<HTMLSpanElement>, "children" | "_id"> & Partial<Pick<CheckboxPrimitive.CheckboxIndicatorProps & RefAttributes<HTMLSpanElement>, "children" | "_id">>>;
|
|
@@ -102,7 +102,8 @@ export interface IntelligentFormPrimitiveSecondaryFormFieldsProps extends Omit<C
|
|
|
102
102
|
children: React.ReactNode | ((fields: FormField[]) => React.ReactNode);
|
|
103
103
|
}
|
|
104
104
|
export declare const IntelligentFormPrimitiveSecondaryFormFields: (props: IntelligentFormPrimitiveSecondaryFormFieldsProps) => import("react/jsx-runtime").JSX.Element;
|
|
105
|
-
|
|
105
|
+
declare const PrimitiveSecondaryFormSubmit: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type" | "_id"> & Partial<Pick< DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type" | "_id">>>;
|
|
106
|
+
export declare const IntelligentFormPrimitiveSecondaryFormSubmit: (props: ComponentPropsWithRef<typeof PrimitiveSecondaryFormSubmit>) => import("react/jsx-runtime").JSX.Element;
|
|
106
107
|
declare const PrimitiveFormError: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id">>>;
|
|
107
108
|
export declare const IntelligentFormPrimitiveFormError: (props: ComponentPropsWithRef<typeof PrimitiveFormError>) => import("react/jsx-runtime").JSX.Element | null;
|
|
108
109
|
export declare const IntelligentFormPrimitiveSources: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
|