@bikdotai/bik-component-library 0.0.875-beta.2 → 0.0.875-beta.3
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/cjs/components/agent-builder/components/ConfigToolPanel.js +11 -11
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +2 -2
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +4 -4
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +27 -10
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js.map +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.d.ts +0 -12
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +145 -149
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +0 -12
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +82 -86
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.js +5 -5
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +0 -12
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +48 -52
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/index.d.ts +2 -18
- package/dist/esm/components/agent-builder/utils/sourceIcons.js +43 -43
- package/dist/esm/components/agent-builder/utils/toolActions.js +3 -3
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +300 -278
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +8 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +170 -126
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +4 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +144 -112
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +32 -31
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.d.ts +2 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +54 -39
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +18 -16
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +73 -27
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js.map +1 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +4 -17
- package/dist/esm/components/dropdown/hooks/useDropdown.js +176 -163
- package/dist/esm/components/dropdown/hooks/useDropdown.js.map +1 -1
- package/dist/esm/components/dropdown/type.d.ts +22 -0
- package/dist/esm/index.js +772 -816
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,10 +7,10 @@ import h from "styled-components";
|
|
|
7
7
|
import { TitleSmall as pe, BodySecondary as fe, BodyCaption as ge } from "../../TypographyStyle.js";
|
|
8
8
|
import { COLORS as o } from "../../../constants/Theme.js";
|
|
9
9
|
import { PickerType as be } from "../../variable-picker-v3/model.js";
|
|
10
|
-
import { CATEGORIES as me, INTEGRATIONS_KEY as k, toolSourceRank as xe, INTEGRATIONS_LABEL as Z,
|
|
10
|
+
import { CATEGORIES as me, INTEGRATIONS_KEY as k, toolSourceRank as xe, INTEGRATIONS_LABEL as Z, isIntegrationSource as ke, CONFIG_TOOL_SOURCES as ve, INTEGRATIONS_RANK as ye } from "../constants/tools.js";
|
|
11
11
|
import { toolSourceLabel as j } from "../utils/mentionSerialization.js";
|
|
12
12
|
import { partitionSources as we, isUnconnectedSource as Ie } from "../utils/sourceGrouping.js";
|
|
13
|
-
import {
|
|
13
|
+
import { INTEGRATIONS_ICON as ee, renderSourceIcon as te, sourceIcon as M } from "../utils/sourceIcons.js";
|
|
14
14
|
import { VariablePicker as Re } from "../../variable-picker-v3/VariablePicker.js";
|
|
15
15
|
import re from "../../../icons/Informational/Common UI/Shield.js";
|
|
16
16
|
const g = (c) => c.meta, A = (c) => g(c)?.plainLabel ?? c.label, Se = "__bik_create_subagent__", Ae = 5, nt = ({
|
|
@@ -133,7 +133,7 @@ const g = (c) => c.meta, A = (c) => g(c)?.plainLabel ?? c.label, Se = "__bik_cre
|
|
|
133
133
|
const X = m.filter(
|
|
134
134
|
(q) => (g(q)?.source ?? "other") === r
|
|
135
135
|
), ae = (_.get(r) ?? []).length;
|
|
136
|
-
if (X.length + ae === 1 && !(d === void 0 &&
|
|
136
|
+
if (X.length + ae === 1 && !(d === void 0 && ke(r))) {
|
|
137
137
|
const q = M(r) ?? d?.icon;
|
|
138
138
|
if (d)
|
|
139
139
|
return {
|
|
@@ -169,7 +169,7 @@ const g = (c) => c.meta, A = (c) => g(c)?.plainLabel ?? c.label, Se = "__bik_cre
|
|
|
169
169
|
(r) => ({ row: u(r), rank: xe(r) })
|
|
170
170
|
);
|
|
171
171
|
return J.length > 0 && Q.push({
|
|
172
|
-
rank:
|
|
172
|
+
rank: ye,
|
|
173
173
|
row: {
|
|
174
174
|
id: k,
|
|
175
175
|
label: Z,
|
|
@@ -187,7 +187,7 @@ const g = (c) => c.meta, A = (c) => g(c)?.plainLabel ?? c.label, Se = "__bik_cre
|
|
|
187
187
|
onActivate: () => E(t)
|
|
188
188
|
}));
|
|
189
189
|
return (_.get(i) ?? []).forEach((t) => {
|
|
190
|
-
const f = i in
|
|
190
|
+
const f = i in ve;
|
|
191
191
|
n.push({
|
|
192
192
|
// A source with several config tools gets one row each, so the key
|
|
193
193
|
// carries the tool it opens.
|
|
@@ -13,18 +13,6 @@ interface RestApiToolPanelProps {
|
|
|
13
13
|
charLimits?: AgentCharLimits;
|
|
14
14
|
/** SideModal stacking order — raise it when opened over another drawer. */
|
|
15
15
|
zIndex?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Portal target for the drawer, passed straight to {@link SideModal}
|
|
18
|
-
* (default `document.body`). Lets a host render it into its own positioned
|
|
19
|
-
* slot rather than as a viewport overlay.
|
|
20
|
-
*/
|
|
21
|
-
element?: Element | DocumentFragment;
|
|
22
|
-
/**
|
|
23
|
-
* Footer button order, passed straight to {@link SideModal} (default
|
|
24
|
-
* `'row'`). Hosts that show this drawer beside their own footer can set
|
|
25
|
-
* `'row-reverse'` to line the Cancel / Save order up with it.
|
|
26
|
-
*/
|
|
27
|
-
footerDirection?: 'row' | 'row-reverse';
|
|
28
16
|
/** Names of the OTHER tools — a new tool can't reuse one of these. */
|
|
29
17
|
existingNames?: string[];
|
|
30
18
|
/**
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import X from "../../../assets/icons/delete.svg.js";
|
|
3
|
+
import Z from "../../../assets/icons/plus.svg.js";
|
|
4
4
|
import { useState as l, useRef as B } from "react";
|
|
5
5
|
import C from "styled-components";
|
|
6
|
-
import { BodyCaption as
|
|
6
|
+
import { BodyCaption as ee, TitleSmall as u } from "../../TypographyStyle.js";
|
|
7
7
|
import { COLORS as a } from "../../../constants/Theme.js";
|
|
8
8
|
import { FieldBlock as m } from "../AgentBuilder.styled.js";
|
|
9
|
-
import { AGENT_CHAR_LIMITS as
|
|
10
|
-
import { DRAWER_BODY_STYLE as
|
|
11
|
-
import { ToolInstructionsField as
|
|
9
|
+
import { AGENT_CHAR_LIMITS as te } from "../constants/charLimits.js";
|
|
10
|
+
import { DRAWER_BODY_STYLE as re, DRAWER_HEADER_STYLE as ne, DrawerHeaderText as oe } from "./DrawerHeaderText.js";
|
|
11
|
+
import { ToolInstructionsField as ae } from "./ToolInstructionsField.js";
|
|
12
12
|
import { VariableInlineField as D } from "./VariableInlineField.js";
|
|
13
|
-
import { SideModal as
|
|
13
|
+
import { SideModal as se } from "../../side-modal/SideModal.js";
|
|
14
14
|
import { Input as _ } from "../../input/Input.js";
|
|
15
|
-
import { Dropdown as
|
|
16
|
-
import { unwrapDropdownValue as
|
|
17
|
-
import { Button as
|
|
15
|
+
import { Dropdown as le } from "../../dropdown/Dropdown.js";
|
|
16
|
+
import { unwrapDropdownValue as ie } from "../../dropdown/utils.js";
|
|
17
|
+
import { Button as de } from "../../button/Button.js";
|
|
18
18
|
import { BikEditor as M } from "../../../editor/BikEditor.js";
|
|
19
|
-
const
|
|
19
|
+
const ce = ["GET", "POST", "PUT", "PATCH", "DELETE"], pe = ce.map((s) => ({
|
|
20
20
|
label: s,
|
|
21
21
|
value: s
|
|
22
|
-
})),
|
|
22
|
+
})), me = (s) => {
|
|
23
23
|
if (!/^https?:\/\//i.test(s))
|
|
24
24
|
return !1;
|
|
25
25
|
let d;
|
|
@@ -29,57 +29,53 @@ const me = ["GET", "POST", "PUT", "PATCH", "DELETE"], he = me.map((s) => ({
|
|
|
29
29
|
return !1;
|
|
30
30
|
}
|
|
31
31
|
return d.includes(".") && !d.startsWith(".") && !d.endsWith(".");
|
|
32
|
-
},
|
|
32
|
+
}, _e = ({
|
|
33
33
|
onClose: s,
|
|
34
34
|
onSave: d,
|
|
35
35
|
initial: o,
|
|
36
36
|
onImprove: N,
|
|
37
|
-
charLimits: f =
|
|
37
|
+
charLimits: f = te,
|
|
38
38
|
zIndex: q,
|
|
39
39
|
existingNames: $ = [],
|
|
40
|
-
variablesData: y
|
|
41
|
-
element: j,
|
|
42
|
-
footerDirection: V
|
|
40
|
+
variablesData: y
|
|
43
41
|
}) => {
|
|
44
|
-
const [g,
|
|
42
|
+
const [g, j] = l(o?.name ?? ""), [v, V] = l(o?.instructions ?? ""), [x, W] = l(o?.url ?? "https://"), [T, z] = l(
|
|
45
43
|
o?.method ?? "POST"
|
|
46
44
|
), [H, S] = l(
|
|
47
45
|
o?.headers ?? [{ key: "", value: "" }]
|
|
48
|
-
), [w,
|
|
46
|
+
), [w, F] = l(o?.requestBody ?? ""), [E, G] = l(
|
|
49
47
|
o?.responseSample ?? ""
|
|
50
48
|
), [I, k] = l(!1), c = B(
|
|
51
49
|
(o?.headers ?? [{ key: "", value: "" }]).map(
|
|
52
50
|
(e, t) => t
|
|
53
51
|
)
|
|
54
52
|
), A = B(c.current.length), L = (e, t) => S(
|
|
55
|
-
(n) => n.map((h,
|
|
56
|
-
),
|
|
53
|
+
(n) => n.map((h, Q) => Q === e ? { ...h, ...t } : h)
|
|
54
|
+
), J = () => {
|
|
57
55
|
c.current = [...c.current, A.current], A.current += 1, S((e) => [...e, { key: "", value: "" }]);
|
|
58
|
-
},
|
|
56
|
+
}, Y = (e) => {
|
|
59
57
|
c.current = c.current.filter((t, n) => n !== e), S((t) => t.filter((n, h) => h !== e));
|
|
60
58
|
}, b = g.trim(), R = b.length > 0 && $.some(
|
|
61
59
|
(e) => e.trim().toLowerCase() === b.toLowerCase()
|
|
62
|
-
), p = x.trim(), O = p.includes("{{variable:") ? /^https?:\/\/./.test(p) :
|
|
60
|
+
), p = x.trim(), O = p.includes("{{variable:") ? /^https?:\/\/./.test(p) : me(p), K = p.length > 0 && p !== "https://" && !O, P = b.length > 0 && O && !R && // The editor's characterLimit is soft (a paste may exceed it, rendered
|
|
63
61
|
// grey) — gate the save so over-limit instructions can't be persisted.
|
|
64
62
|
v.length <= f.instructions;
|
|
65
63
|
return /* @__PURE__ */ i(
|
|
66
|
-
|
|
64
|
+
se,
|
|
67
65
|
{
|
|
68
66
|
header: "Rest API",
|
|
69
67
|
closeOnEscapeKey: !1,
|
|
70
68
|
zIndex: q,
|
|
71
|
-
element: j,
|
|
72
|
-
footerDirection: V,
|
|
73
69
|
headerCustomComponent: /* @__PURE__ */ r(
|
|
74
|
-
|
|
70
|
+
oe,
|
|
75
71
|
{
|
|
76
72
|
title: "Rest API",
|
|
77
73
|
subtitle: "Connect to any API endpoint. Define the request and a sample response for the agent to reference."
|
|
78
74
|
}
|
|
79
75
|
),
|
|
80
76
|
width: "431px",
|
|
81
|
-
headerStyle:
|
|
82
|
-
bodyStyle:
|
|
77
|
+
headerStyle: ne,
|
|
78
|
+
bodyStyle: re,
|
|
83
79
|
onClose: s,
|
|
84
80
|
saveButtonProps: {
|
|
85
81
|
"data-test": "restapi-save",
|
|
@@ -132,16 +128,16 @@ const me = ["GET", "POST", "PUT", "PATCH", "DELETE"], he = me.map((s) => ({
|
|
|
132
128
|
maxCharLimit: f.name,
|
|
133
129
|
state: R ? "invalid" : void 0,
|
|
134
130
|
errorMessage: R ? "A tool with this name already exists" : void 0,
|
|
135
|
-
onChangeText:
|
|
131
|
+
onChangeText: j
|
|
136
132
|
}
|
|
137
133
|
),
|
|
138
134
|
/* @__PURE__ */ r(
|
|
139
|
-
|
|
135
|
+
ae,
|
|
140
136
|
{
|
|
141
137
|
"data-test": "restapi-instructions",
|
|
142
138
|
label: "Instructions",
|
|
143
139
|
value: v,
|
|
144
|
-
onChange:
|
|
140
|
+
onChange: V,
|
|
145
141
|
maxLength: f.instructions,
|
|
146
142
|
placeholder: "Describe how should the LLM generate the rest API",
|
|
147
143
|
onImprove: N,
|
|
@@ -156,26 +152,26 @@ const me = ["GET", "POST", "PUT", "PATCH", "DELETE"], he = me.map((s) => ({
|
|
|
156
152
|
label: "Request URL",
|
|
157
153
|
placeholder: "https://",
|
|
158
154
|
value: x,
|
|
159
|
-
onChange:
|
|
155
|
+
onChange: W,
|
|
160
156
|
variablesData: y
|
|
161
157
|
}
|
|
162
158
|
),
|
|
163
|
-
|
|
159
|
+
K && /* @__PURE__ */ r(ee, { color: a.content.negative, children: "Enter a valid URL (including https://)" })
|
|
164
160
|
] }),
|
|
165
161
|
/* @__PURE__ */ i(m, { children: [
|
|
166
162
|
/* @__PURE__ */ r(u, { color: a.content.primary, children: "HTTP method" }),
|
|
167
163
|
/* @__PURE__ */ r(
|
|
168
|
-
|
|
164
|
+
le,
|
|
169
165
|
{
|
|
170
166
|
"data-test": "restapi-method",
|
|
171
167
|
size: "small",
|
|
172
168
|
width: "100%",
|
|
173
169
|
dropdownWidth: "399px",
|
|
174
|
-
options:
|
|
170
|
+
options: pe,
|
|
175
171
|
defaultOptions: [{ label: T, value: T }],
|
|
176
172
|
onSelect: (e) => {
|
|
177
|
-
const t =
|
|
178
|
-
t &&
|
|
173
|
+
const t = ie(e);
|
|
174
|
+
t && z(t);
|
|
179
175
|
}
|
|
180
176
|
}
|
|
181
177
|
)
|
|
@@ -183,7 +179,7 @@ const me = ["GET", "POST", "PUT", "PATCH", "DELETE"], he = me.map((s) => ({
|
|
|
183
179
|
/* @__PURE__ */ i(m, { children: [
|
|
184
180
|
/* @__PURE__ */ r(u, { color: a.content.primary, children: "Headers" }),
|
|
185
181
|
H.map((e, t) => /* @__PURE__ */ i(
|
|
186
|
-
|
|
182
|
+
he,
|
|
187
183
|
{
|
|
188
184
|
"data-test": `restapi-header-${t}`,
|
|
189
185
|
children: [
|
|
@@ -207,14 +203,14 @@ const me = ["GET", "POST", "PUT", "PATCH", "DELETE"], he = me.map((s) => ({
|
|
|
207
203
|
}
|
|
208
204
|
),
|
|
209
205
|
/* @__PURE__ */ r(
|
|
210
|
-
|
|
206
|
+
fe,
|
|
211
207
|
{
|
|
212
208
|
type: "button",
|
|
213
209
|
"aria-label": "Remove header",
|
|
214
210
|
"data-test": `restapi-header-remove-${t}`,
|
|
215
|
-
onClick: () =>
|
|
211
|
+
onClick: () => Y(t),
|
|
216
212
|
children: /* @__PURE__ */ r(
|
|
217
|
-
|
|
213
|
+
X,
|
|
218
214
|
{
|
|
219
215
|
width: 16,
|
|
220
216
|
height: 16,
|
|
@@ -227,15 +223,15 @@ const me = ["GET", "POST", "PUT", "PATCH", "DELETE"], he = me.map((s) => ({
|
|
|
227
223
|
},
|
|
228
224
|
c.current[t]
|
|
229
225
|
)),
|
|
230
|
-
/* @__PURE__ */ r(
|
|
231
|
-
|
|
226
|
+
/* @__PURE__ */ r(ue, { children: /* @__PURE__ */ r(
|
|
227
|
+
de,
|
|
232
228
|
{
|
|
233
229
|
"data-test": "restapi-add-header",
|
|
234
230
|
buttonType: "dashRegular",
|
|
235
231
|
size: "small",
|
|
236
|
-
LeadingIcon:
|
|
232
|
+
LeadingIcon: Z,
|
|
237
233
|
buttonText: "Add header",
|
|
238
|
-
onClick:
|
|
234
|
+
onClick: J
|
|
239
235
|
}
|
|
240
236
|
) })
|
|
241
237
|
] }),
|
|
@@ -248,7 +244,7 @@ const me = ["GET", "POST", "PUT", "PATCH", "DELETE"], he = me.map((s) => ({
|
|
|
248
244
|
initialContent: w,
|
|
249
245
|
style: U,
|
|
250
246
|
placeholder: "Type or paste JSON here",
|
|
251
|
-
onChange: (e) =>
|
|
247
|
+
onChange: (e) => F(e.text),
|
|
252
248
|
minHeight: "120px",
|
|
253
249
|
maxHeight: "240px"
|
|
254
250
|
}
|
|
@@ -263,7 +259,7 @@ const me = ["GET", "POST", "PUT", "PATCH", "DELETE"], he = me.map((s) => ({
|
|
|
263
259
|
style: U,
|
|
264
260
|
initialContent: E,
|
|
265
261
|
placeholder: "Type or paste JSON here",
|
|
266
|
-
onChange: (e) =>
|
|
262
|
+
onChange: (e) => G(e.text),
|
|
267
263
|
minHeight: "120px",
|
|
268
264
|
maxHeight: "240px"
|
|
269
265
|
}
|
|
@@ -272,14 +268,14 @@ const me = ["GET", "POST", "PUT", "PATCH", "DELETE"], he = me.map((s) => ({
|
|
|
272
268
|
]
|
|
273
269
|
}
|
|
274
270
|
);
|
|
275
|
-
},
|
|
271
|
+
}, he = C.div`
|
|
276
272
|
display: grid;
|
|
277
273
|
grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 32px;
|
|
278
274
|
align-items: center;
|
|
279
275
|
gap: 8px;
|
|
280
|
-
`,
|
|
276
|
+
`, ue = C.div`
|
|
281
277
|
display: flex;
|
|
282
|
-
`,
|
|
278
|
+
`, fe = C.button`
|
|
283
279
|
display: inline-flex;
|
|
284
280
|
align-items: center;
|
|
285
281
|
justify-content: center;
|
|
@@ -300,6 +296,6 @@ const me = ["GET", "POST", "PUT", "PATCH", "DELETE"], he = me.map((s) => ({
|
|
|
300
296
|
};
|
|
301
297
|
export {
|
|
302
298
|
U as JsonFieldBox,
|
|
303
|
-
|
|
299
|
+
_e as RestApiToolPanel
|
|
304
300
|
};
|
|
305
301
|
//# sourceMappingURL=RestApiToolPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestApiToolPanel.js","sources":["../../../../../src/components/agent-builder/components/RestApiToolPanel.tsx"],"sourcesContent":["import DeleteIcon from '@src/assets/icons/delete.svg';\nimport PlusIcon from '@src/assets/icons/plus.svg';\nimport { BikEditor } from '@src/editor';\nimport React, { useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { Button } from '@src/components/button';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { Input } from '@src/components/input';\nimport { SideModal } from '@src/components/side-modal';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport type { VariableListInterfaceV3 } from '../../variable-picker-v3/model';\nimport {\n\tRestApiHeader,\n\tRestApiMethod,\n\tRestApiToolConfig,\n} from '../AgentBuilder.model';\nimport { FieldBlock } from '../AgentBuilder.styled';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport {\n\tDRAWER_BODY_STYLE,\n\tDRAWER_HEADER_STYLE,\n\tDrawerHeaderText,\n} from './DrawerHeaderText';\nimport { ToolInstructionsField } from './ToolInstructionsField';\nimport { VariableInlineField } from './VariableInlineField';\n\ninterface RestApiToolPanelProps {\n\tonClose: () => void;\n\t/** Persist the config. A pending promise shows the Save loader. */\n\tonSave: (config: RestApiToolConfig) => void | Promise<void>;\n\t/** Seed values when editing an existing tool. */\n\tinitial?: RestApiToolConfig;\n\t/** Optional \"Improve with AI\" for the instructions field. Omit to hide it. */\n\tonImprove?: (text: string) => Promise<string>;\n\tcharLimits?: AgentCharLimits;\n\t/** SideModal stacking order — raise it when opened over another drawer. */\n\tzIndex?: number;\n\t/**\n\t * Portal target for the drawer, passed straight to {@link SideModal}\n\t * (default `document.body`). Lets a host render it into its own positioned\n\t * slot rather than as a viewport overlay.\n\t */\n\telement?: Element | DocumentFragment;\n\t/**\n\t * Footer button order, passed straight to {@link SideModal} (default\n\t * `'row'`). Hosts that show this drawer beside their own footer can set\n\t * `'row-reverse'` to line the Cancel / Save order up with it.\n\t */\n\tfooterDirection?: 'row' | 'row-reverse';\n\t/** Names of the OTHER tools — a new tool can't reuse one of these. */\n\texistingNames?: string[];\n\t/**\n\t * Variable catalog for the `@` trigger. When non-empty, `@` opens the\n\t * variable picker directly in Instructions / Request URL / header values.\n\t * (Request / Response JSON editors are deliberately not wired for now.)\n\t * Absent → the drawer behaves exactly as before.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\n}\n\nconst METHODS: RestApiMethod[] = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];\nconst METHOD_OPTIONS: SingleOption[] = METHODS.map((m) => ({\n\tlabel: m,\n\tvalue: m,\n}));\n\n// A callable endpoint needs an explicit http(s):// scheme AND a real, dotted\n// host. `new URL` alone is too lenient — it accepts single-label hosts\n// (\"https://abc\"), a one-slash scheme (\"https:/abc.com\"), and dangling-dot\n// hosts (\"https://.com\" / \"https://abc.\"). Require the `://` prefix on the raw\n// value plus a hostname that is either dotted (example.com) or an IPv4.\nconst isValidHttpUrl = (value: string): boolean => {\n\tif (!/^https?:\\/\\//i.test(value)) {\n\t\treturn false;\n\t}\n\tlet host: string;\n\ttry {\n\t\thost = new URL(value).hostname;\n\t} catch {\n\t\treturn false;\n\t}\n\treturn host.includes('.') && !host.startsWith('.') && !host.endsWith('.');\n};\n\n/**\n * Right-side drawer to configure a \"Rest API\" tool: the endpoint the agent can\n * call, plus a JSON request-body template and a sample response. Mount it fresh\n * per open (key it) so `initial` seeds the state. Built on the shared `SideModal`\n * shell and the BikEditor JSON body mode for the Request / Response editors.\n */\nexport const RestApiToolPanel: React.FC<RestApiToolPanelProps> = ({\n\tonClose,\n\tonSave,\n\tinitial,\n\tonImprove,\n\tcharLimits = AGENT_CHAR_LIMITS,\n\tzIndex,\n\texistingNames = [],\n\tvariablesData,\n\telement,\n\tfooterDirection,\n}) => {\n\tconst [name, setName] = useState(initial?.name ?? '');\n\tconst [instructions, setInstructions] = useState(initial?.instructions ?? '');\n\t// New tools start with the scheme pre-filled so the user only types the host.\n\tconst [url, setUrl] = useState(initial?.url ?? 'https://');\n\tconst [method, setMethod] = useState<RestApiMethod>(\n\t\tinitial?.method ?? 'POST',\n\t);\n\tconst [headers, setHeaders] = useState<RestApiHeader[]>(\n\t\tinitial?.headers ?? [{ key: '', value: '' }],\n\t);\n\tconst [requestBody, setRequestBody] = useState(initial?.requestBody ?? '');\n\tconst [responseSample, setResponseSample] = useState(\n\t\tinitial?.responseSample ?? '',\n\t);\n\tconst [saving, setSaving] = useState(false);\n\n\t// Stable per-row identity for React keys, parallel to `headers`. The value\n\t// field is an uncontrolled editor, so a row must keep its mount across\n\t// sibling add/remove — index-based keys would remount every row (dropping\n\t// focus mid-edit) or let a deleted row's text linger in a reused neighbour.\n\tconst headerIdsRef = useRef<number[]>(\n\t\t(initial?.headers ?? [{ key: '', value: '' }]).map(\n\t\t\t(_h: RestApiHeader, i: number) => i,\n\t\t),\n\t);\n\tconst nextHeaderIdRef = useRef(headerIdsRef.current.length);\n\n\tconst patchHeader = (i: number, patch: Partial<RestApiHeader>) =>\n\t\tsetHeaders((prev) =>\n\t\t\tprev.map((h, idx) => (idx === i ? { ...h, ...patch } : h)),\n\t\t);\n\tconst addHeader = () => {\n\t\theaderIdsRef.current = [...headerIdsRef.current, nextHeaderIdRef.current];\n\t\tnextHeaderIdRef.current += 1;\n\t\tsetHeaders((prev) => [...prev, { key: '', value: '' }]);\n\t};\n\tconst removeHeader = (i: number) => {\n\t\theaderIdsRef.current = headerIdsRef.current.filter((_, idx) => idx !== i);\n\t\tsetHeaders((prev) => prev.filter((_, idx) => idx !== i));\n\t};\n\n\tconst nameTrimmed = name.trim();\n\t// Case-insensitive: two tools can't share a name (the LLM references them by it).\n\tconst isDuplicateName =\n\t\tnameTrimmed.length > 0 &&\n\t\texistingNames.some(\n\t\t\t(n) => n.trim().toLowerCase() === nameTrimmed.toLowerCase(),\n\t\t);\n\tconst urlTrimmed = url.trim();\n\t// Save needs a real endpoint, but don't flash the error while the field still\n\t// holds its pristine \"https://\" seed — only once the user has typed past it.\n\t// A URL that interpolates variables can't be parsed literally (braces are\n\t// invalid URL characters) — accept it once a scheme + something follows;\n\t// it only becomes a concrete URL after runtime substitution.\n\tconst urlUsesVariables = urlTrimmed.includes('{{variable:');\n\tconst urlOk = urlUsesVariables\n\t\t? /^https?:\\/\\/./.test(urlTrimmed)\n\t\t: isValidHttpUrl(urlTrimmed);\n\tconst isUrlInvalid =\n\t\turlTrimmed.length > 0 && urlTrimmed !== 'https://' && !urlOk;\n\tconst canSave =\n\t\tnameTrimmed.length > 0 &&\n\t\turlOk &&\n\t\t!isDuplicateName &&\n\t\t// The editor's characterLimit is soft (a paste may exceed it, rendered\n\t\t// grey) — gate the save so over-limit instructions can't be persisted.\n\t\tinstructions.length <= charLimits.instructions;\n\n\tconst handleSave = async () => {\n\t\tif (!canSave || saving) {\n\t\t\treturn;\n\t\t}\n\t\tconst config: RestApiToolConfig = {\n\t\t\tid: initial?.id ?? `restapi_${Date.now().toString(36)}`,\n\t\t\tname: name.trim(),\n\t\t\tinstructions,\n\t\t\turl: url.trim(),\n\t\t\tmethod,\n\t\t\t// Drop fully-empty header rows.\n\t\t\theaders: headers.filter((h) => h.key.trim() || h.value.trim()),\n\t\t\trequestBody,\n\t\t\tresponseSample,\n\t\t};\n\t\tconst result = onSave(config);\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSaving(false);\n\t\t\t}\n\t\t}\n\t};\n\n\treturn (\n\t\t<SideModal\n\t\t\theader=\"Rest API\"\n\t\t\tcloseOnEscapeKey={false}\n\t\t\tzIndex={zIndex}\n\t\t\telement={element}\n\t\t\tfooterDirection={footerDirection}\n\t\t\theaderCustomComponent={\n\t\t\t\t<DrawerHeaderText\n\t\t\t\t\ttitle=\"Rest API\"\n\t\t\t\t\tsubtitle=\"Connect to any API endpoint. Define the request and a sample response for the agent to reference.\"\n\t\t\t\t/>\n\t\t\t}\n\t\t\twidth=\"431px\"\n\t\t\theaderStyle={DRAWER_HEADER_STYLE}\n\t\t\tbodyStyle={DRAWER_BODY_STYLE}\n\t\t\tonClose={onClose}\n\t\t\tsaveButtonProps={{\n\t\t\t\t'data-test': 'restapi-save',\n\t\t\t\tbuttonText: 'Save',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tdisabled: !canSave,\n\t\t\t\tisLoading: saving,\n\t\t\t\tonClick: handleSave,\n\t\t\t}}\n\t\t\tcancelButtonProps={{\n\t\t\t\t'data-test': 'restapi-cancel',\n\t\t\t\tbuttonText: 'Cancel',\n\t\t\t\tbuttonType: 'tertiaryGray',\n\t\t\t\tsize: 'small',\n\t\t\t\tonClick: onClose,\n\t\t\t}}\n\t\t>\n\t\t\t<Input\n\t\t\t\tdata-test=\"restapi-name\"\n\t\t\t\tvariant=\"small\"\n\t\t\t\tlabelText=\"Name\"\n\t\t\t\tlabelTextBold\n\t\t\t\tplaceholder=\"Enter action name\"\n\t\t\t\tvalue={name}\n\t\t\t\tmaxCharLimit={charLimits.name}\n\t\t\t\tstate={isDuplicateName ? 'invalid' : undefined}\n\t\t\t\terrorMessage={\n\t\t\t\t\tisDuplicateName ? 'A tool with this name already exists' : undefined\n\t\t\t\t}\n\t\t\t\tonChangeText={setName}\n\t\t\t/>\n\n\t\t\t<ToolInstructionsField\n\t\t\t\tdata-test=\"restapi-instructions\"\n\t\t\t\tlabel=\"Instructions\"\n\t\t\t\tvalue={instructions}\n\t\t\t\tonChange={setInstructions}\n\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\tplaceholder=\"Describe how should the LLM generate the rest API\"\n\t\t\t\tonImprove={onImprove}\n\t\t\t\tvariablesData={variablesData}\n\t\t\t/>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<VariableInlineField\n\t\t\t\t\tdata-test=\"restapi-url\"\n\t\t\t\t\tlabel=\"Request URL\"\n\t\t\t\t\tplaceholder=\"https://\"\n\t\t\t\t\tvalue={url}\n\t\t\t\t\tonChange={setUrl}\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t/>\n\t\t\t\t{/* VariableInlineField has no invalid state of its own — surface the\n\t\t\t\t URL validation (from main) as a caption below the field. */}\n\t\t\t\t{isUrlInvalid && (\n\t\t\t\t\t<BodyCaption color={COLORS.content.negative}>\n\t\t\t\t\t\tEnter a valid URL (including https://)\n\t\t\t\t\t</BodyCaption>\n\t\t\t\t)}\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>HTTP method</TitleSmall>\n\t\t\t\t<Dropdown\n\t\t\t\t\tdata-test=\"restapi-method\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\tdropdownWidth=\"399px\"\n\t\t\t\t\toptions={METHOD_OPTIONS}\n\t\t\t\t\tdefaultOptions={[{ label: method, value: method }]}\n\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\tsetMethod(v as RestApiMethod);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Headers</TitleSmall>\n\t\t\t\t{headers.map((h, i) => (\n\t\t\t\t\t<HeaderRow\n\t\t\t\t\t\tkey={headerIdsRef.current[i]}\n\t\t\t\t\t\tdata-test={`restapi-header-${i}`}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\tvariant=\"small\"\n\t\t\t\t\t\t\thideInputHeader\n\t\t\t\t\t\t\tplaceholder=\"Enter name\"\n\t\t\t\t\t\t\tvalue={h.key}\n\t\t\t\t\t\t\tonChangeText={(v) => patchHeader(i, { key: v })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<VariableInlineField\n\t\t\t\t\t\t\tplaceholder=\"Enter value\"\n\t\t\t\t\t\t\tvalue={h.value}\n\t\t\t\t\t\t\tonChange={(v) => patchHeader(i, { value: v })}\n\t\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<IconBtn\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\taria-label=\"Remove header\"\n\t\t\t\t\t\t\tdata-test={`restapi-header-remove-${i}`}\n\t\t\t\t\t\t\tonClick={() => removeHeader(i)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<DeleteIcon\n\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</IconBtn>\n\t\t\t\t\t</HeaderRow>\n\t\t\t\t))}\n\t\t\t\t<AddHeaderRow>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tdata-test=\"restapi-add-header\"\n\t\t\t\t\t\tbuttonType=\"dashRegular\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tLeadingIcon={PlusIcon}\n\t\t\t\t\t\tbuttonText=\"Add header\"\n\t\t\t\t\t\tonClick={addHeader}\n\t\t\t\t\t/>\n\t\t\t\t</AddHeaderRow>\n\t\t\t</FieldBlock>\n\n\t\t\t{/* Variables intentionally NOT wired here (yet) — the JSON editors are\n\t\t\t plain code fields; @ types a literal @. */}\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Request </TitleSmall>\n\t\t\t\t<BikEditor\n\t\t\t\t\tfeatures={{ jsonMode: true }}\n\t\t\t\t\tinitialContent={requestBody}\n\t\t\t\t\tstyle={JsonFieldBox}\n\t\t\t\t\tplaceholder=\"Type or paste JSON here\"\n\t\t\t\t\tonChange={(c) => setRequestBody(c.text)}\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\tmaxHeight=\"240px\"\n\t\t\t\t/>\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Response </TitleSmall>\n\t\t\t\t<BikEditor\n\t\t\t\t\tfeatures={{ jsonMode: true }}\n\t\t\t\t\tstyle={JsonFieldBox}\n\t\t\t\t\tinitialContent={responseSample}\n\t\t\t\t\tplaceholder=\"Type or paste JSON here\"\n\t\t\t\t\tonChange={(c) => setResponseSample(c.text)}\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\tmaxHeight=\"240px\"\n\t\t\t\t/>\n\t\t\t</FieldBlock>\n\t\t</SideModal>\n\t);\n};\n\n// Fixed tracks (name / value / delete): minmax(0, …) lets the fields shrink\n// below their content width, so a long value scrolls inside its field and the\n// delete button can never be pushed off the row.\nconst HeaderRow = styled.div`\n\tdisplay: grid;\n\tgrid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 32px;\n\talign-items: center;\n\tgap: 8px;\n`;\n\nconst AddHeaderRow = styled.div`\n\tdisplay: flex;\n`;\n\nconst IconBtn = styled.button`\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\tflex-shrink: 0;\n\twidth: 32px;\n\theight: 32px;\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 4px;\n\tbackground: ${COLORS.surface.standard};\n\tcursor: pointer;\n\n\t&:hover {\n\t\tborder-color: ${COLORS.content.secondary};\n\t}\n`;\n\nexport const JsonFieldBox = {\n\tborderRadius: '4px',\n\toverflow: 'hidden',\n};\n"],"names":["METHODS","METHOD_OPTIONS","m","isValidHttpUrl","value","host","RestApiToolPanel","onClose","onSave","initial","onImprove","charLimits","AGENT_CHAR_LIMITS","zIndex","existingNames","variablesData","element","footerDirection","name","setName","useState","instructions","setInstructions","url","setUrl","method","setMethod","headers","setHeaders","requestBody","setRequestBody","responseSample","setResponseSample","saving","setSaving","headerIdsRef","useRef","_h","i","nextHeaderIdRef","patchHeader","patch","prev","idx","addHeader","removeHeader","_","nameTrimmed","isDuplicateName","n","urlTrimmed","urlOk","isUrlInvalid","canSave","jsxs","SideModal","jsx","DrawerHeaderText","DRAWER_HEADER_STYLE","DRAWER_BODY_STYLE","config","h","result","Input","ToolInstructionsField","FieldBlock","VariableInlineField","BodyCaption","COLORS","TitleSmall","Dropdown","opt","v","unwrapDropdownValue","HeaderRow","IconBtn","DeleteIcon","AddHeaderRow","Button","PlusIcon","BikEditor","JsonFieldBox","c","styled"],"mappings":";;;;;;;;;;;;;;;;;;AA+DA,MAAMA,KAA2B,CAAC,OAAO,QAAQ,OAAO,SAAS,QAAQ,GACnEC,KAAiCD,GAAQ,IAAI,CAACE,OAAO;AAAA,EAC1D,OAAOA;AAAA,EACP,OAAOA;AACR,EAAE,GAOIC,KAAiB,CAACC,MAA2B;AAClD,MAAI,CAAC,gBAAgB,KAAKA,CAAK;AAC9B,WAAO;AAER,MAAIC;AACJ,MAAI;AACH,IAAAA,IAAO,IAAI,IAAID,CAAK,EAAE;AAAA,EACvB,QAAQ;AACP,WAAO;AAAA,EACR;AACA,SAAOC,EAAK,SAAS,GAAG,KAAK,CAACA,EAAK,WAAW,GAAG,KAAK,CAACA,EAAK,SAAS,GAAG;AACzE,GAQaC,KAAoD,CAAC;AAAA,EACjE,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC,IAAaC;AAAA,EACb,QAAAC;AAAA,EACA,eAAAC,IAAgB,CAAA;AAAA,EAChB,eAAAC;AAAA,EACA,SAAAC;AAAA,EACA,iBAAAC;AACD,MAAM;AAC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AACmD,MAAMlD,EAAkBkD,EAAE,IAAI;AAAA,cACzC,WAAU;AAAA,cACV,WAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QACX,EAAA,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGH,GAKMR,KAAYS,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOnBN,KAAeM,EAAO;AAAA;AAAA,GAItBR,KAAUQ,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAOFf,EAAO,OAAO,OAAO;AAAA;AAAA,eAE3BA,EAAO,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA,kBAIpBA,EAAO,QAAQ,SAAS;AAAA;AAAA,GAI7Ba,IAAe;AAAA,EAC3B,cAAc;AAAA,EACd,UAAU;AACX;"}
|
|
1
|
+
{"version":3,"file":"RestApiToolPanel.js","sources":["../../../../../src/components/agent-builder/components/RestApiToolPanel.tsx"],"sourcesContent":["import DeleteIcon from '@src/assets/icons/delete.svg';\nimport PlusIcon from '@src/assets/icons/plus.svg';\nimport { BikEditor } from '@src/editor';\nimport React, { useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { Button } from '@src/components/button';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { Input } from '@src/components/input';\nimport { SideModal } from '@src/components/side-modal';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport type { VariableListInterfaceV3 } from '../../variable-picker-v3/model';\nimport {\n\tRestApiHeader,\n\tRestApiMethod,\n\tRestApiToolConfig,\n} from '../AgentBuilder.model';\nimport { FieldBlock } from '../AgentBuilder.styled';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport {\n\tDRAWER_BODY_STYLE,\n\tDRAWER_HEADER_STYLE,\n\tDrawerHeaderText,\n} from './DrawerHeaderText';\nimport { ToolInstructionsField } from './ToolInstructionsField';\nimport { VariableInlineField } from './VariableInlineField';\n\ninterface RestApiToolPanelProps {\n\tonClose: () => void;\n\t/** Persist the config. A pending promise shows the Save loader. */\n\tonSave: (config: RestApiToolConfig) => void | Promise<void>;\n\t/** Seed values when editing an existing tool. */\n\tinitial?: RestApiToolConfig;\n\t/** Optional \"Improve with AI\" for the instructions field. Omit to hide it. */\n\tonImprove?: (text: string) => Promise<string>;\n\tcharLimits?: AgentCharLimits;\n\t/** SideModal stacking order — raise it when opened over another drawer. */\n\tzIndex?: number;\n\t/** Names of the OTHER tools — a new tool can't reuse one of these. */\n\texistingNames?: string[];\n\t/**\n\t * Variable catalog for the `@` trigger. When non-empty, `@` opens the\n\t * variable picker directly in Instructions / Request URL / header values.\n\t * (Request / Response JSON editors are deliberately not wired for now.)\n\t * Absent → the drawer behaves exactly as before.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\n}\n\nconst METHODS: RestApiMethod[] = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];\nconst METHOD_OPTIONS: SingleOption[] = METHODS.map((m) => ({\n\tlabel: m,\n\tvalue: m,\n}));\n\n// A callable endpoint needs an explicit http(s):// scheme AND a real, dotted\n// host. `new URL` alone is too lenient — it accepts single-label hosts\n// (\"https://abc\"), a one-slash scheme (\"https:/abc.com\"), and dangling-dot\n// hosts (\"https://.com\" / \"https://abc.\"). Require the `://` prefix on the raw\n// value plus a hostname that is either dotted (example.com) or an IPv4.\nconst isValidHttpUrl = (value: string): boolean => {\n\tif (!/^https?:\\/\\//i.test(value)) {\n\t\treturn false;\n\t}\n\tlet host: string;\n\ttry {\n\t\thost = new URL(value).hostname;\n\t} catch {\n\t\treturn false;\n\t}\n\treturn host.includes('.') && !host.startsWith('.') && !host.endsWith('.');\n};\n\n/**\n * Right-side drawer to configure a \"Rest API\" tool: the endpoint the agent can\n * call, plus a JSON request-body template and a sample response. Mount it fresh\n * per open (key it) so `initial` seeds the state. Built on the shared `SideModal`\n * shell and the BikEditor JSON body mode for the Request / Response editors.\n */\nexport const RestApiToolPanel: React.FC<RestApiToolPanelProps> = ({\n\tonClose,\n\tonSave,\n\tinitial,\n\tonImprove,\n\tcharLimits = AGENT_CHAR_LIMITS,\n\tzIndex,\n\texistingNames = [],\n\tvariablesData,\n}) => {\n\tconst [name, setName] = useState(initial?.name ?? '');\n\tconst [instructions, setInstructions] = useState(initial?.instructions ?? '');\n\t// New tools start with the scheme pre-filled so the user only types the host.\n\tconst [url, setUrl] = useState(initial?.url ?? 'https://');\n\tconst [method, setMethod] = useState<RestApiMethod>(\n\t\tinitial?.method ?? 'POST',\n\t);\n\tconst [headers, setHeaders] = useState<RestApiHeader[]>(\n\t\tinitial?.headers ?? [{ key: '', value: '' }],\n\t);\n\tconst [requestBody, setRequestBody] = useState(initial?.requestBody ?? '');\n\tconst [responseSample, setResponseSample] = useState(\n\t\tinitial?.responseSample ?? '',\n\t);\n\tconst [saving, setSaving] = useState(false);\n\n\t// Stable per-row identity for React keys, parallel to `headers`. The value\n\t// field is an uncontrolled editor, so a row must keep its mount across\n\t// sibling add/remove — index-based keys would remount every row (dropping\n\t// focus mid-edit) or let a deleted row's text linger in a reused neighbour.\n\tconst headerIdsRef = useRef<number[]>(\n\t\t(initial?.headers ?? [{ key: '', value: '' }]).map(\n\t\t\t(_h: RestApiHeader, i: number) => i,\n\t\t),\n\t);\n\tconst nextHeaderIdRef = useRef(headerIdsRef.current.length);\n\n\tconst patchHeader = (i: number, patch: Partial<RestApiHeader>) =>\n\t\tsetHeaders((prev) =>\n\t\t\tprev.map((h, idx) => (idx === i ? { ...h, ...patch } : h)),\n\t\t);\n\tconst addHeader = () => {\n\t\theaderIdsRef.current = [...headerIdsRef.current, nextHeaderIdRef.current];\n\t\tnextHeaderIdRef.current += 1;\n\t\tsetHeaders((prev) => [...prev, { key: '', value: '' }]);\n\t};\n\tconst removeHeader = (i: number) => {\n\t\theaderIdsRef.current = headerIdsRef.current.filter((_, idx) => idx !== i);\n\t\tsetHeaders((prev) => prev.filter((_, idx) => idx !== i));\n\t};\n\n\tconst nameTrimmed = name.trim();\n\t// Case-insensitive: two tools can't share a name (the LLM references them by it).\n\tconst isDuplicateName =\n\t\tnameTrimmed.length > 0 &&\n\t\texistingNames.some(\n\t\t\t(n) => n.trim().toLowerCase() === nameTrimmed.toLowerCase(),\n\t\t);\n\tconst urlTrimmed = url.trim();\n\t// Save needs a real endpoint, but don't flash the error while the field still\n\t// holds its pristine \"https://\" seed — only once the user has typed past it.\n\t// A URL that interpolates variables can't be parsed literally (braces are\n\t// invalid URL characters) — accept it once a scheme + something follows;\n\t// it only becomes a concrete URL after runtime substitution.\n\tconst urlUsesVariables = urlTrimmed.includes('{{variable:');\n\tconst urlOk = urlUsesVariables\n\t\t? /^https?:\\/\\/./.test(urlTrimmed)\n\t\t: isValidHttpUrl(urlTrimmed);\n\tconst isUrlInvalid =\n\t\turlTrimmed.length > 0 && urlTrimmed !== 'https://' && !urlOk;\n\tconst canSave =\n\t\tnameTrimmed.length > 0 &&\n\t\turlOk &&\n\t\t!isDuplicateName &&\n\t\t// The editor's characterLimit is soft (a paste may exceed it, rendered\n\t\t// grey) — gate the save so over-limit instructions can't be persisted.\n\t\tinstructions.length <= charLimits.instructions;\n\n\tconst handleSave = async () => {\n\t\tif (!canSave || saving) {\n\t\t\treturn;\n\t\t}\n\t\tconst config: RestApiToolConfig = {\n\t\t\tid: initial?.id ?? `restapi_${Date.now().toString(36)}`,\n\t\t\tname: name.trim(),\n\t\t\tinstructions,\n\t\t\turl: url.trim(),\n\t\t\tmethod,\n\t\t\t// Drop fully-empty header rows.\n\t\t\theaders: headers.filter((h) => h.key.trim() || h.value.trim()),\n\t\t\trequestBody,\n\t\t\tresponseSample,\n\t\t};\n\t\tconst result = onSave(config);\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSaving(false);\n\t\t\t}\n\t\t}\n\t};\n\n\treturn (\n\t\t<SideModal\n\t\t\theader=\"Rest API\"\n\t\t\tcloseOnEscapeKey={false}\n\t\t\tzIndex={zIndex}\n\t\t\theaderCustomComponent={\n\t\t\t\t<DrawerHeaderText\n\t\t\t\t\ttitle=\"Rest API\"\n\t\t\t\t\tsubtitle=\"Connect to any API endpoint. Define the request and a sample response for the agent to reference.\"\n\t\t\t\t/>\n\t\t\t}\n\t\t\twidth=\"431px\"\n\t\t\theaderStyle={DRAWER_HEADER_STYLE}\n\t\t\tbodyStyle={DRAWER_BODY_STYLE}\n\t\t\tonClose={onClose}\n\t\t\tsaveButtonProps={{\n\t\t\t\t'data-test': 'restapi-save',\n\t\t\t\tbuttonText: 'Save',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tdisabled: !canSave,\n\t\t\t\tisLoading: saving,\n\t\t\t\tonClick: handleSave,\n\t\t\t}}\n\t\t\tcancelButtonProps={{\n\t\t\t\t'data-test': 'restapi-cancel',\n\t\t\t\tbuttonText: 'Cancel',\n\t\t\t\tbuttonType: 'tertiaryGray',\n\t\t\t\tsize: 'small',\n\t\t\t\tonClick: onClose,\n\t\t\t}}\n\t\t>\n\t\t\t<Input\n\t\t\t\tdata-test=\"restapi-name\"\n\t\t\t\tvariant=\"small\"\n\t\t\t\tlabelText=\"Name\"\n\t\t\t\tlabelTextBold\n\t\t\t\tplaceholder=\"Enter action name\"\n\t\t\t\tvalue={name}\n\t\t\t\tmaxCharLimit={charLimits.name}\n\t\t\t\tstate={isDuplicateName ? 'invalid' : undefined}\n\t\t\t\terrorMessage={\n\t\t\t\t\tisDuplicateName ? 'A tool with this name already exists' : undefined\n\t\t\t\t}\n\t\t\t\tonChangeText={setName}\n\t\t\t/>\n\n\t\t\t<ToolInstructionsField\n\t\t\t\tdata-test=\"restapi-instructions\"\n\t\t\t\tlabel=\"Instructions\"\n\t\t\t\tvalue={instructions}\n\t\t\t\tonChange={setInstructions}\n\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\tplaceholder=\"Describe how should the LLM generate the rest API\"\n\t\t\t\tonImprove={onImprove}\n\t\t\t\tvariablesData={variablesData}\n\t\t\t/>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<VariableInlineField\n\t\t\t\t\tdata-test=\"restapi-url\"\n\t\t\t\t\tlabel=\"Request URL\"\n\t\t\t\t\tplaceholder=\"https://\"\n\t\t\t\t\tvalue={url}\n\t\t\t\t\tonChange={setUrl}\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t/>\n\t\t\t\t{/* VariableInlineField has no invalid state of its own — surface the\n\t\t\t\t URL validation (from main) as a caption below the field. */}\n\t\t\t\t{isUrlInvalid && (\n\t\t\t\t\t<BodyCaption color={COLORS.content.negative}>\n\t\t\t\t\t\tEnter a valid URL (including https://)\n\t\t\t\t\t</BodyCaption>\n\t\t\t\t)}\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>HTTP method</TitleSmall>\n\t\t\t\t<Dropdown\n\t\t\t\t\tdata-test=\"restapi-method\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\tdropdownWidth=\"399px\"\n\t\t\t\t\toptions={METHOD_OPTIONS}\n\t\t\t\t\tdefaultOptions={[{ label: method, value: method }]}\n\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\tsetMethod(v as RestApiMethod);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Headers</TitleSmall>\n\t\t\t\t{headers.map((h, i) => (\n\t\t\t\t\t<HeaderRow\n\t\t\t\t\t\tkey={headerIdsRef.current[i]}\n\t\t\t\t\t\tdata-test={`restapi-header-${i}`}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\tvariant=\"small\"\n\t\t\t\t\t\t\thideInputHeader\n\t\t\t\t\t\t\tplaceholder=\"Enter name\"\n\t\t\t\t\t\t\tvalue={h.key}\n\t\t\t\t\t\t\tonChangeText={(v) => patchHeader(i, { key: v })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<VariableInlineField\n\t\t\t\t\t\t\tplaceholder=\"Enter value\"\n\t\t\t\t\t\t\tvalue={h.value}\n\t\t\t\t\t\t\tonChange={(v) => patchHeader(i, { value: v })}\n\t\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<IconBtn\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\taria-label=\"Remove header\"\n\t\t\t\t\t\t\tdata-test={`restapi-header-remove-${i}`}\n\t\t\t\t\t\t\tonClick={() => removeHeader(i)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<DeleteIcon\n\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</IconBtn>\n\t\t\t\t\t</HeaderRow>\n\t\t\t\t))}\n\t\t\t\t<AddHeaderRow>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tdata-test=\"restapi-add-header\"\n\t\t\t\t\t\tbuttonType=\"dashRegular\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tLeadingIcon={PlusIcon}\n\t\t\t\t\t\tbuttonText=\"Add header\"\n\t\t\t\t\t\tonClick={addHeader}\n\t\t\t\t\t/>\n\t\t\t\t</AddHeaderRow>\n\t\t\t</FieldBlock>\n\n\t\t\t{/* Variables intentionally NOT wired here (yet) — the JSON editors are\n\t\t\t plain code fields; @ types a literal @. */}\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Request </TitleSmall>\n\t\t\t\t<BikEditor\n\t\t\t\t\tfeatures={{ jsonMode: true }}\n\t\t\t\t\tinitialContent={requestBody}\n\t\t\t\t\tstyle={JsonFieldBox}\n\t\t\t\t\tplaceholder=\"Type or paste JSON here\"\n\t\t\t\t\tonChange={(c) => setRequestBody(c.text)}\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\tmaxHeight=\"240px\"\n\t\t\t\t/>\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Response </TitleSmall>\n\t\t\t\t<BikEditor\n\t\t\t\t\tfeatures={{ jsonMode: true }}\n\t\t\t\t\tstyle={JsonFieldBox}\n\t\t\t\t\tinitialContent={responseSample}\n\t\t\t\t\tplaceholder=\"Type or paste JSON here\"\n\t\t\t\t\tonChange={(c) => setResponseSample(c.text)}\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\tmaxHeight=\"240px\"\n\t\t\t\t/>\n\t\t\t</FieldBlock>\n\t\t</SideModal>\n\t);\n};\n\n// Fixed tracks (name / value / delete): minmax(0, …) lets the fields shrink\n// below their content width, so a long value scrolls inside its field and the\n// delete button can never be pushed off the row.\nconst HeaderRow = styled.div`\n\tdisplay: grid;\n\tgrid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 32px;\n\talign-items: center;\n\tgap: 8px;\n`;\n\nconst AddHeaderRow = styled.div`\n\tdisplay: flex;\n`;\n\nconst IconBtn = styled.button`\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\tflex-shrink: 0;\n\twidth: 32px;\n\theight: 32px;\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 4px;\n\tbackground: ${COLORS.surface.standard};\n\tcursor: pointer;\n\n\t&:hover {\n\t\tborder-color: ${COLORS.content.secondary};\n\t}\n`;\n\nexport const JsonFieldBox = {\n\tborderRadius: '4px',\n\toverflow: 'hidden',\n};\n"],"names":["METHODS","METHOD_OPTIONS","m","isValidHttpUrl","value","host","RestApiToolPanel","onClose","onSave","initial","onImprove","charLimits","AGENT_CHAR_LIMITS","zIndex","existingNames","variablesData","name","setName","useState","instructions","setInstructions","url","setUrl","method","setMethod","headers","setHeaders","requestBody","setRequestBody","responseSample","setResponseSample","saving","setSaving","headerIdsRef","useRef","_h","i","nextHeaderIdRef","patchHeader","patch","prev","idx","addHeader","removeHeader","_","nameTrimmed","isDuplicateName","n","urlTrimmed","urlOk","isUrlInvalid","canSave","jsxs","SideModal","jsx","DrawerHeaderText","DRAWER_HEADER_STYLE","DRAWER_BODY_STYLE","config","h","result","Input","ToolInstructionsField","FieldBlock","VariableInlineField","BodyCaption","COLORS","TitleSmall","Dropdown","opt","v","unwrapDropdownValue","HeaderRow","IconBtn","DeleteIcon","AddHeaderRow","Button","PlusIcon","BikEditor","JsonFieldBox","c","styled"],"mappings":";;;;;;;;;;;;;;;;;;AAmDA,MAAMA,KAA2B,CAAC,OAAO,QAAQ,OAAO,SAAS,QAAQ,GACnEC,KAAiCD,GAAQ,IAAI,CAACE,OAAO;AAAA,EAC1D,OAAOA;AAAA,EACP,OAAOA;AACR,EAAE,GAOIC,KAAiB,CAACC,MAA2B;AAClD,MAAI,CAAC,gBAAgB,KAAKA,CAAK;AAC9B,WAAO;AAER,MAAIC;AACJ,MAAI;AACH,IAAAA,IAAO,IAAI,IAAID,CAAK,EAAE;AAAA,EACvB,QAAQ;AACP,WAAO;AAAA,EACR;AACA,SAAOC,EAAK,SAAS,GAAG,KAAK,CAACA,EAAK,WAAW,GAAG,KAAK,CAACA,EAAK,SAAS,GAAG;AACzE,GAQaC,KAAoD,CAAC;AAAA,EACjE,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC,IAAaC;AAAA,EACb,QAAAC;AAAA,EACA,eAAAC,IAAgB,CAAA;AAAA,EAChB,eAAAC;AACD,MAAM;AACL,QAAM,CAACC,GA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AAAA,cACV,WAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QACX,EAAA,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGH,GAKMR,KAAYS,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAOnBN,KAAeM,EAAO;AAAA;AAAA,GAItBR,KAAUQ,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAOFf,EAAO,OAAO,OAAO;AAAA;AAAA,eAE3BA,EAAO,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA,kBAIpBA,EAAO,QAAQ,SAAS;AAAA;AAAA,GAI7Ba,IAAe;AAAA,EAC3B,cAAc;AAAA,EACd,UAAU;AACX;"}
|
|
@@ -2,16 +2,6 @@ export { AgentBuilder } from './AgentBuilder';
|
|
|
2
2
|
export { Channels } from '@bikdotai/bik-models/campaigns/models/Channel';
|
|
3
3
|
export { AgentStateModal } from './components/AgentStateModal';
|
|
4
4
|
export type { AgentModalState } from './components/AgentStateModal';
|
|
5
|
-
export { ConfigToolPanel } from './components/ConfigToolPanel';
|
|
6
|
-
export { CreateSubAgentPanel } from './components/CreateSubAgentPanel';
|
|
7
|
-
export { RestApiToolPanel } from './components/RestApiToolPanel';
|
|
8
|
-
export { SelectableListSection } from './components/SelectableListSection';
|
|
9
|
-
export type { SelectableItem, SourceGroup, } from './components/SelectableListSection';
|
|
10
|
-
export { MentionEditor } from './components/MentionEditor';
|
|
11
|
-
export { MentionPicker } from './components/MentionPicker';
|
|
12
|
-
export { AiTextArea } from './components/AiTextArea';
|
|
13
|
-
export { ToolInstructionsField } from './components/ToolInstructionsField';
|
|
14
|
-
export { DrawerHeaderText } from './components/DrawerHeaderText';
|
|
15
5
|
export { useAgentDraft } from './hooks/useAgentDraft';
|
|
16
6
|
export type { AgentDraft } from './hooks/useAgentDraft';
|
|
17
7
|
export { AGENT_CHAR_LIMITS } from './constants/charLimits';
|
|
@@ -19,12 +9,6 @@ export type { AgentCharLimits } from './constants/charLimits';
|
|
|
19
9
|
export { APP_TOKEN, resolveAppToken, STEP_DEFINITIONS, } from './constants/steps';
|
|
20
10
|
export { AGENT_CHANNEL_TYPES, channelPresentation, CHANNEL_PRESENTATION, } from './constants/channels';
|
|
21
11
|
export type { ChannelPresentation } from './constants/channels';
|
|
22
|
-
export { ToolSource
|
|
23
|
-
export
|
|
24
|
-
export { AGENT_EDITOR_STYLE } from './constants/editorStyle';
|
|
25
|
-
export { buildAgentMentionItems, editorDocToInstructions, instructionsToEditorHtml, toolSourceLabel, appTypeLabel, } from './utils/mentionSerialization';
|
|
26
|
-
export { SOURCE_ICONS, sourceIcon, renderSourceIcon, GENERIC_SOURCE_ICON, } from './utils/sourceIcons';
|
|
27
|
-
export { buildToolActions } from './utils/toolActions';
|
|
28
|
-
export { partitionSources, isUnconnectedSource } from './utils/sourceGrouping';
|
|
29
|
-
export { FieldBlock, FieldLabelRow, SectionHeaderWrap, SectionBodyWrap, } from './AgentBuilder.styled';
|
|
12
|
+
export { ToolSource } from './constants/tools';
|
|
13
|
+
export { buildAgentMentionItems, editorDocToInstructions, instructionsToEditorHtml, } from './utils/mentionSerialization';
|
|
30
14
|
export type { AgentBuilderProps, AgentBuilderConfig, AgentValue, AgentStatus as AgentBuilderStatus, StepKey, StepValidation, TriggerMode, AgentTriggerValue, AgentHandoverConfig, HandoverMethod, AgentTool, SubAgentRef, SubAgentDraft, IntentOption, ModelOption, RestApiToolConfig, RestApiMethod, RestApiHeader, ConfigToolConfig, ConfigToolKey, ParamField, ParamsBlob, ToolRef, CatalogTool, CustomTool, AgentChannel, AgentChannelAccount, AgentChannelSelection, AgentChannelStatus, AgentChannelType, } from './AgentBuilder.model';
|
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
import i from "react";
|
|
2
|
-
import {
|
|
3
|
-
import e from "../../../icons/
|
|
4
|
-
import S from "../../../icons/Social/Channels/
|
|
5
|
-
import h from "../../../icons/Social/Channels/
|
|
6
|
-
import c from "../../../icons/Social/Channels/
|
|
7
|
-
import p from "../../../icons/Social/
|
|
8
|
-
import I from "../../../icons/Social/
|
|
9
|
-
import f from "../../../icons/Social/Channels/
|
|
10
|
-
import g from "../../../icons/Social/Channels/
|
|
11
|
-
import v from "../../../icons/Social/Channels/
|
|
12
|
-
import w from "../../../icons/Social/Channels/
|
|
13
|
-
import s from "../../../icons/Social/Channels/
|
|
14
|
-
import a from "../../../icons/Social/
|
|
15
|
-
import l from "../../../icons/
|
|
16
|
-
import d from "../../../icons/
|
|
17
|
-
import k from "../../../icons/BIK AI specific/Webhook.js";
|
|
2
|
+
import { INTEGRATIONS_KEY as n, ToolSource as o } from "../constants/tools.js";
|
|
3
|
+
import e from "../../../icons/Social/Channels/GoogleSheets.js";
|
|
4
|
+
import S from "../../../icons/Social/Channels/ShipBob.js";
|
|
5
|
+
import h from "../../../icons/Social/Channels/Kustomer.js";
|
|
6
|
+
import c from "../../../icons/Social/Channels/Freshdesk.js";
|
|
7
|
+
import p from "../../../icons/Social/Social/Zendesk.js";
|
|
8
|
+
import I from "../../../icons/Social/Channels/Segment.js";
|
|
9
|
+
import f from "../../../icons/Social/Channels/Mailchimp.js";
|
|
10
|
+
import g from "../../../icons/Social/Channels/Attentive.js";
|
|
11
|
+
import v from "../../../icons/Social/Channels/OmniSend.js";
|
|
12
|
+
import w from "../../../icons/Social/Channels/Klavyio.js";
|
|
13
|
+
import s from "../../../icons/Social/Channels/Aftership.js";
|
|
14
|
+
import a from "../../../icons/Social/Social/SlackIcon.js";
|
|
15
|
+
import l from "../../../icons/Informational/Communication/Email.js";
|
|
16
|
+
import d from "../../../icons/BIK AI specific/Webhook.js";
|
|
18
17
|
import t from "../../../icons/Informational/Identity/PuzzlePiece.js";
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
18
|
+
import k from "../../../icons/Social/Social/Gorgias.js";
|
|
19
|
+
import E from "../../../icons/Social/Channels/Skio.js";
|
|
20
|
+
import u from "../../../icons/Social/Channels/ShipStation.js";
|
|
21
|
+
import O from "../../../icons/Social/Social/BigCommerce.js";
|
|
22
|
+
import G from "../../../icons/Social/Channels/ShopifyBrand.js";
|
|
23
|
+
import N from "../../../icons/Social/Channels/ManifestGlass.js";
|
|
24
|
+
import A from "../../../icons/Actions/Common actions/LinkSimpleHorizontal.js";
|
|
25
25
|
const C = {
|
|
26
|
-
[o.Manifest]: { Icon:
|
|
27
|
-
[o.Shopify]: { Icon:
|
|
28
|
-
[o.Bigcommerce]: { Icon:
|
|
29
|
-
[o.Shipstation]: { Icon:
|
|
30
|
-
[o.Skio]: { Icon:
|
|
31
|
-
[o.Gorgias]: { Icon:
|
|
26
|
+
[o.Manifest]: { Icon: N, w: 24, h: 24 },
|
|
27
|
+
[o.Shopify]: { Icon: G, w: 24, h: 24 },
|
|
28
|
+
[o.Bigcommerce]: { Icon: O, w: 20, h: 20 },
|
|
29
|
+
[o.Shipstation]: { Icon: u, w: 22, h: 22 },
|
|
30
|
+
[o.Skio]: { Icon: E, w: 20, h: 20 },
|
|
31
|
+
[o.Gorgias]: { Icon: k, w: 20, h: 20 },
|
|
32
32
|
[o.Integration]: { Icon: t, w: 20, h: 20 },
|
|
33
|
-
[o.RestApi]: { Icon:
|
|
34
|
-
[o.EmailHandover]: { Icon:
|
|
35
|
-
[o.Slack]: { Icon:
|
|
33
|
+
[o.RestApi]: { Icon: d, w: 20, h: 20 },
|
|
34
|
+
[o.EmailHandover]: { Icon: l, w: 20, h: 20 },
|
|
35
|
+
[o.Slack]: { Icon: a, w: 20, h: 20 },
|
|
36
36
|
// Standard-contract vendors — brand glyphs from the shared icon set.
|
|
37
|
-
[o.Aftership]: { Icon:
|
|
38
|
-
[o.Klaviyo]: { Icon:
|
|
39
|
-
[o.Omnisend]: { Icon:
|
|
40
|
-
[o.Attentive]: { Icon:
|
|
41
|
-
[o.Mailchimp]: { Icon:
|
|
42
|
-
[o.Segment]: { Icon:
|
|
43
|
-
[o.Zendesk]: { Icon:
|
|
44
|
-
[o.Freshdesk]: { Icon:
|
|
45
|
-
[o.Kustomer]: { Icon:
|
|
46
|
-
[o.Shipbob]: { Icon:
|
|
47
|
-
[o.GoogleSheets]: { Icon:
|
|
37
|
+
[o.Aftership]: { Icon: s, w: 20, h: 20 },
|
|
38
|
+
[o.Klaviyo]: { Icon: w, w: 20, h: 20 },
|
|
39
|
+
[o.Omnisend]: { Icon: v, w: 20, h: 20 },
|
|
40
|
+
[o.Attentive]: { Icon: g, w: 20, h: 20 },
|
|
41
|
+
[o.Mailchimp]: { Icon: f, w: 20, h: 20 },
|
|
42
|
+
[o.Segment]: { Icon: I, w: 20, h: 20 },
|
|
43
|
+
[o.Zendesk]: { Icon: p, w: 20, h: 20 },
|
|
44
|
+
[o.Freshdesk]: { Icon: c, w: 20, h: 20 },
|
|
45
|
+
[o.Kustomer]: { Icon: h, w: 20, h: 20 },
|
|
46
|
+
[o.Shipbob]: { Icon: S, w: 20, h: 20 },
|
|
47
|
+
[o.GoogleSheets]: { Icon: e, w: 20, h: 20 }
|
|
48
48
|
}, R = {
|
|
49
49
|
Icon: t,
|
|
50
50
|
w: 20,
|
|
51
51
|
h: 20
|
|
52
52
|
}, _ = {
|
|
53
|
-
Icon:
|
|
53
|
+
Icon: A,
|
|
54
54
|
w: 20,
|
|
55
55
|
h: 20
|
|
56
56
|
}, oo = (r) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TOOL_ACTION_SOURCES as T,
|
|
1
|
+
import { TOOL_ACTION_SOURCES as T, TOOL_ACTION_LABELS as o, TOOL_SOURCE_LABELS as a, CONFIG_TOOL_SOURCES as i, CONFIG_TOOL_ACTION_LABELS as A } from "../constants/tools.js";
|
|
2
2
|
import { SOURCE_ICONS as E } from "./sourceIcons.js";
|
|
3
3
|
const f = (L, t, S, l) => T.flatMap((O) => {
|
|
4
|
-
const _ =
|
|
4
|
+
const _ = i[O], C = {
|
|
5
5
|
source: O,
|
|
6
6
|
icon: E[O],
|
|
7
7
|
connected: S?.[O],
|
|
@@ -15,7 +15,7 @@ const f = (L, t, S, l) => T.flatMap((O) => {
|
|
|
15
15
|
})) : [
|
|
16
16
|
{
|
|
17
17
|
...C,
|
|
18
|
-
label:
|
|
18
|
+
label: o[O] ?? a[O],
|
|
19
19
|
onSelect: () => t(O)
|
|
20
20
|
}
|
|
21
21
|
];
|