@bikdotai/bik-component-library 0.0.850-beta.2 → 0.0.850-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/assets/icons/ShipStation.svg.js +1 -1
- package/dist/cjs/assets/icons/ShipStation.svg.js.map +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +0 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/DiscardModal.js +1 -1
- package/dist/cjs/components/agent-builder/components/DiscardModal.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
- package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionPicker.js +32 -24
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/editor/BikEditor.js +1 -1
- package/dist/cjs/editor/BikEditor.js.map +1 -1
- package/dist/cjs/editor/BikEditor.styles.js +17 -12
- package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
- package/dist/cjs/editor/BikEditor.types.js.map +1 -1
- package/dist/cjs/editor/extensions/buildExtensions.js +2 -2
- package/dist/cjs/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/cjs/editor/extensions/characterLimit/CharacterLimitExtension.js +3 -3
- package/dist/cjs/editor/extensions/characterLimit/CharacterLimitExtension.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/assets/icons/ShipStation.svg.js +2 -2
- package/dist/esm/assets/icons/ShipStation.svg.js.map +1 -1
- package/dist/esm/assets/icons/index.d.ts +1 -0
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js +4 -5
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/esm/components/agent-builder/components/DiscardModal.js +57 -49
- package/dist/esm/components/agent-builder/components/DiscardModal.js.map +1 -1
- package/dist/esm/components/agent-builder/components/GoLiveModal.js +26 -22
- package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionEditor.js +24 -23
- package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.js +81 -73
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/editor/BikEditor.js +70 -68
- package/dist/esm/editor/BikEditor.js.map +1 -1
- package/dist/esm/editor/BikEditor.styles.js +20 -15
- package/dist/esm/editor/BikEditor.styles.js.map +1 -1
- package/dist/esm/editor/BikEditor.types.d.ts +10 -0
- package/dist/esm/editor/BikEditor.types.js.map +1 -1
- package/dist/esm/editor/extensions/buildExtensions.d.ts +6 -0
- package/dist/esm/editor/extensions/buildExtensions.js +20 -15
- package/dist/esm/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/esm/editor/extensions/characterLimit/CharacterLimitExtension.d.ts +20 -3
- package/dist/esm/editor/extensions/characterLimit/CharacterLimitExtension.js +40 -25
- package/dist/esm/editor/extensions/characterLimit/CharacterLimitExtension.js.map +1 -1
- package/dist/esm/index.js +761 -759
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,60 +1,68 @@
|
|
|
1
1
|
import { jsx as t, jsxs as e } from "react/jsx-runtime";
|
|
2
2
|
import { TitleMedium as c, BodyPrimary as m } from "../../TypographyStyle.js";
|
|
3
|
-
import { COLORS as
|
|
4
|
-
import { ModalBody as
|
|
5
|
-
import { StyledModal as
|
|
6
|
-
import { Button as
|
|
3
|
+
import { COLORS as a } from "../../../constants/Theme.js";
|
|
4
|
+
import { ModalBody as p, ModalActions as h } from "../AgentBuilder.styled.js";
|
|
5
|
+
import { StyledModal as u } from "../../modals/styledModal.js";
|
|
6
|
+
import { Button as i } from "../../button/Button.js";
|
|
7
7
|
const M = ({
|
|
8
|
-
open:
|
|
9
|
-
onClose:
|
|
10
|
-
onDiscard:
|
|
11
|
-
onSaveDraft:
|
|
12
|
-
isSaving:
|
|
8
|
+
open: r,
|
|
9
|
+
onClose: d,
|
|
10
|
+
onDiscard: o,
|
|
11
|
+
onSaveDraft: n,
|
|
12
|
+
isSaving: l,
|
|
13
13
|
disableSaveDraft: s
|
|
14
|
-
}) =>
|
|
15
|
-
|
|
14
|
+
}) => r ? /* @__PURE__ */ t(
|
|
15
|
+
u,
|
|
16
16
|
{
|
|
17
17
|
"data-test": "agent-discard-modal",
|
|
18
18
|
open: !0,
|
|
19
|
-
onClose:
|
|
19
|
+
onClose: d,
|
|
20
20
|
width: "530px",
|
|
21
|
-
children: /* @__PURE__ */ e(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
21
|
+
children: /* @__PURE__ */ e(
|
|
22
|
+
p,
|
|
23
|
+
{
|
|
24
|
+
style: { alignItems: "flex-start", textAlign: "left", gap: "32px" },
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
27
|
+
/* @__PURE__ */ t(c, { color: a.content.primary, children: "You have unsaved changes" }),
|
|
28
|
+
/* @__PURE__ */ t(
|
|
29
|
+
m,
|
|
30
|
+
{
|
|
31
|
+
color: a.content.secondary,
|
|
32
|
+
style: { lineHeight: "24px" },
|
|
33
|
+
children: "Leaving now will discard your recent changes. You can save them and come back to this later."
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
] }),
|
|
37
|
+
/* @__PURE__ */ e(h, { children: [
|
|
38
|
+
/* @__PURE__ */ t("div", { style: { display: "flex" }, children: /* @__PURE__ */ t(
|
|
39
|
+
i,
|
|
40
|
+
{
|
|
41
|
+
"data-test": "agent-discard-leave",
|
|
42
|
+
buttonType: "secondary",
|
|
43
|
+
size: "medium",
|
|
44
|
+
matchParentWidth: !0,
|
|
45
|
+
buttonText: "Discard",
|
|
46
|
+
onClick: o
|
|
47
|
+
}
|
|
48
|
+
) }),
|
|
49
|
+
/* @__PURE__ */ t("div", { style: { display: "flex" }, children: /* @__PURE__ */ t(
|
|
50
|
+
i,
|
|
51
|
+
{
|
|
52
|
+
"data-test": "agent-discard-save-draft",
|
|
53
|
+
buttonType: "primary",
|
|
54
|
+
size: "medium",
|
|
55
|
+
matchParentWidth: !0,
|
|
56
|
+
buttonText: "Save as draft",
|
|
57
|
+
disabled: s,
|
|
58
|
+
isLoading: l,
|
|
59
|
+
onClick: n
|
|
60
|
+
}
|
|
61
|
+
) })
|
|
62
|
+
] })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
)
|
|
58
66
|
}
|
|
59
67
|
) : null;
|
|
60
68
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscardModal.js","sources":["../../../../../src/components/agent-builder/components/DiscardModal.tsx"],"sourcesContent":["import React from 'react';\nimport { Button } from '@src/components/button';\nimport { StyledModal } from '@src/components/modals';\nimport { BodyPrimary, TitleMedium } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { ModalActions, ModalBody } from '../AgentBuilder.styled';\n\ninterface DiscardModalProps {\n\topen: boolean;\n\t/** Dismiss the dialog and stay on the builder (X / outside click). */\n\tonClose: () => void;\n\t/** Leave without saving. */\n\tonDiscard: () => void;\n\t/** Save the draft, then leave. */\n\tonSaveDraft: () => void;\n\tisSaving?: boolean;\n\t/** Block \"Save as draft\" (e.g. the agent has no name yet). */\n\tdisableSaveDraft?: boolean;\n}\n\n/**\n * \"You have unsaved changes\" confirmation shown when the user tries to leave the\n * builder (Back). Actions live inside the body (see GoLiveModal for why we avoid\n * StyledModal's footer). Content is left-aligned per design.\n */\nexport const DiscardModal: React.FC<DiscardModalProps> = ({\n\topen,\n\tonClose,\n\tonDiscard,\n\tonSaveDraft,\n\tisSaving,\n\tdisableSaveDraft,\n}) => {\n\tif (!open) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StyledModal\n\t\t\tdata-test=\"agent-discard-modal\"\n\t\t\topen\n\t\t\tonClose={onClose}\n\t\t\twidth=\"530px\"\n\t\t>\n\t\t\t<ModalBody
|
|
1
|
+
{"version":3,"file":"DiscardModal.js","sources":["../../../../../src/components/agent-builder/components/DiscardModal.tsx"],"sourcesContent":["import React from 'react';\nimport { Button } from '@src/components/button';\nimport { StyledModal } from '@src/components/modals';\nimport { BodyPrimary, TitleMedium } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { ModalActions, ModalBody } from '../AgentBuilder.styled';\n\ninterface DiscardModalProps {\n\topen: boolean;\n\t/** Dismiss the dialog and stay on the builder (X / outside click). */\n\tonClose: () => void;\n\t/** Leave without saving. */\n\tonDiscard: () => void;\n\t/** Save the draft, then leave. */\n\tonSaveDraft: () => void;\n\tisSaving?: boolean;\n\t/** Block \"Save as draft\" (e.g. the agent has no name yet). */\n\tdisableSaveDraft?: boolean;\n}\n\n/**\n * \"You have unsaved changes\" confirmation shown when the user tries to leave the\n * builder (Back). Actions live inside the body (see GoLiveModal for why we avoid\n * StyledModal's footer). Content is left-aligned per design.\n */\nexport const DiscardModal: React.FC<DiscardModalProps> = ({\n\topen,\n\tonClose,\n\tonDiscard,\n\tonSaveDraft,\n\tisSaving,\n\tdisableSaveDraft,\n}) => {\n\tif (!open) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StyledModal\n\t\t\tdata-test=\"agent-discard-modal\"\n\t\t\topen\n\t\t\tonClose={onClose}\n\t\t\twidth=\"530px\"\n\t\t>\n\t\t\t<ModalBody\n\t\t\t\tstyle={{ alignItems: 'flex-start', textAlign: 'left', gap: '32px' }}\n\t\t\t>\n\t\t\t\t<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>\n\t\t\t\t\t<TitleMedium color={COLORS.content.primary}>\n\t\t\t\t\t\tYou have unsaved changes\n\t\t\t\t\t</TitleMedium>\n\t\t\t\t\t<BodyPrimary\n\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\tstyle={{ lineHeight: '24px' }}\n\t\t\t\t\t>\n\t\t\t\t\t\tLeaving now will discard your recent changes. You can save them and\n\t\t\t\t\t\tcome back to this later.\n\t\t\t\t\t</BodyPrimary>\n\t\t\t\t</div>\n\n\t\t\t\t<ModalActions>\n\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdata-test=\"agent-discard-leave\"\n\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\tbuttonText=\"Discard\"\n\t\t\t\t\t\t\tonClick={onDiscard}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdata-test=\"agent-discard-save-draft\"\n\t\t\t\t\t\t\tbuttonType=\"primary\"\n\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\tbuttonText=\"Save as draft\"\n\t\t\t\t\t\t\tdisabled={disableSaveDraft}\n\t\t\t\t\t\t\tisLoading={isSaving}\n\t\t\t\t\t\t\tonClick={onSaveDraft}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</ModalActions>\n\t\t\t</ModalBody>\n\t\t</StyledModal>\n\t);\n};\n"],"names":["DiscardModal","open","onClose","onDiscard","onSaveDraft","isSaving","disableSaveDraft","jsx","StyledModal","jsxs","ModalBody","TitleMedium","COLORS","BodyPrimary","ModalActions","Button"],"mappings":";;;;;;AAyBO,MAAMA,IAA4C,CAAC;AAAA,EACzD,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,kBAAAC;AACD,MACML,IAKJ,gBAAAM;AAAA,EAACC;AAAA,EAAA;AAAA,IACA,aAAU;AAAA,IACV,MAAI;AAAA,IACJ,SAAAN;AAAA,IACA,OAAM;AAAA,IAEN,UAAA,gBAAAO;AAAA,MAACC;AAAA,MAAA;AAAA,QACA,OAAO,EAAE,YAAY,cAAc,WAAW,QAAQ,KAAK,OAAA;AAAA,QAE3D,UAAA;AAAA,UAAA,gBAAAD,EAAC,OAAA,EAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,KAAK,MAAA,GAC5D,UAAA;AAAA,YAAA,gBAAAF,EAACI,GAAA,EAAY,OAAOC,EAAO,QAAQ,SAAS,UAAA,4BAE5C;AAAA,YACA,gBAAAL;AAAA,cAACM;AAAA,cAAA;AAAA,gBACA,OAAOD,EAAO,QAAQ;AAAA,gBACtB,OAAO,EAAE,YAAY,OAAA;AAAA,gBACrB,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAGD,GACD;AAAA,4BAECE,GAAA,EACA,UAAA;AAAA,YAAA,gBAAAP,EAAC,OAAA,EAAI,OAAO,EAAE,SAAS,UACtB,UAAA,gBAAAA;AAAA,cAACQ;AAAA,cAAA;AAAA,gBACA,aAAU;AAAA,gBACV,YAAW;AAAA,gBACX,MAAK;AAAA,gBACL,kBAAgB;AAAA,gBAChB,YAAW;AAAA,gBACX,SAASZ;AAAA,cAAA;AAAA,YAAA,GAEX;AAAA,8BACC,OAAA,EAAI,OAAO,EAAE,SAAS,UACtB,UAAA,gBAAAI;AAAA,cAACQ;AAAA,cAAA;AAAA,gBACA,aAAU;AAAA,gBACV,YAAW;AAAA,gBACX,MAAK;AAAA,gBACL,kBAAgB;AAAA,gBAChB,YAAW;AAAA,gBACX,UAAUT;AAAA,gBACV,WAAWD;AAAA,gBACX,SAASD;AAAA,cAAA;AAAA,YAAA,EACV,CACD;AAAA,UAAA,EAAA,CACD;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACD;AAAA,IAlDM;"}
|
|
@@ -1,35 +1,39 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
1
|
+
import { jsx as t, jsxs as i, Fragment as m } from "react/jsx-runtime";
|
|
2
2
|
import h from "../../../assets/icons/ManifestGlass.svg.js";
|
|
3
|
-
import
|
|
4
|
-
import { TitleMedium as
|
|
3
|
+
import p from "../../../assets/icons/successIcon.svg.js";
|
|
4
|
+
import { TitleMedium as u, BodyPrimary as g } from "../../TypographyStyle.js";
|
|
5
5
|
import { COLORS as n } from "../../../constants/Theme.js";
|
|
6
|
-
import { ModalBody as y, ModalIcon as f, ModalActions as
|
|
6
|
+
import { ModalBody as y, ModalIcon as f, ModalActions as x, DraftButtonScope as v } from "../AgentBuilder.styled.js";
|
|
7
7
|
import { StyledModal as b } from "../../modals/styledModal.js";
|
|
8
8
|
import { Button as o } from "../../button/Button.js";
|
|
9
9
|
import S from "../../../icons/Arrows/Normal arrows/ArrowRight.js";
|
|
10
10
|
const z = ({
|
|
11
|
-
mode:
|
|
12
|
-
onClose:
|
|
11
|
+
mode: r,
|
|
12
|
+
onClose: a,
|
|
13
13
|
onConfirm: d,
|
|
14
|
-
onSaveDraft:
|
|
15
|
-
onGoToDashboard:
|
|
16
|
-
isPublishing:
|
|
14
|
+
onSaveDraft: l,
|
|
15
|
+
onGoToDashboard: s,
|
|
16
|
+
isPublishing: c
|
|
17
17
|
}) => {
|
|
18
|
-
if (!
|
|
18
|
+
if (!r)
|
|
19
19
|
return null;
|
|
20
|
-
const e =
|
|
20
|
+
const e = r === "success";
|
|
21
21
|
return /* @__PURE__ */ t(
|
|
22
22
|
b,
|
|
23
23
|
{
|
|
24
24
|
"data-test": "agent-go-live-modal",
|
|
25
25
|
open: !0,
|
|
26
|
-
onClose:
|
|
26
|
+
onClose: a,
|
|
27
27
|
width: e ? "400px" : "520px",
|
|
28
|
-
children: /* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
children: /* @__PURE__ */ i(y, { style: { gap: "24px" }, children: [
|
|
29
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
30
|
+
/* @__PURE__ */ t(f, { children: e ? /* @__PURE__ */ t(p, { width: 64, height: 64 }) : /* @__PURE__ */ t(h, { width: 64, height: 64 }) }),
|
|
31
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
32
|
+
/* @__PURE__ */ t(u, { color: n.content.primary, children: e ? "Your agent is live!" : "Ready to go live?" }),
|
|
33
|
+
/* @__PURE__ */ t(g, { color: n.content.secondary, children: e ? "You can manage your agents from the AI agent dashboard." : "This agent will start handling customer conversations immediately. You can pause it at any time." })
|
|
34
|
+
] })
|
|
35
|
+
] }),
|
|
36
|
+
/* @__PURE__ */ t(x, { children: e ? /* @__PURE__ */ t("div", { style: { display: "flex" }, children: /* @__PURE__ */ t(
|
|
33
37
|
o,
|
|
34
38
|
{
|
|
35
39
|
"data-test": "agent-go-dashboard",
|
|
@@ -38,10 +42,10 @@ const z = ({
|
|
|
38
42
|
matchParentWidth: !0,
|
|
39
43
|
buttonText: "Go to Agent dashboard",
|
|
40
44
|
TrailingIcon: S,
|
|
41
|
-
onClick:
|
|
45
|
+
onClick: s ?? a
|
|
42
46
|
}
|
|
43
|
-
) }) : /* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */ t(
|
|
47
|
+
) }) : /* @__PURE__ */ i(m, { children: [
|
|
48
|
+
/* @__PURE__ */ t(v, { children: /* @__PURE__ */ t(
|
|
45
49
|
o,
|
|
46
50
|
{
|
|
47
51
|
"data-test": "agent-confirm-save-draft",
|
|
@@ -49,7 +53,7 @@ const z = ({
|
|
|
49
53
|
size: "medium",
|
|
50
54
|
matchParentWidth: !0,
|
|
51
55
|
buttonText: "Save as draft",
|
|
52
|
-
onClick:
|
|
56
|
+
onClick: l
|
|
53
57
|
}
|
|
54
58
|
) }),
|
|
55
59
|
/* @__PURE__ */ t("div", { style: { display: "flex" }, children: /* @__PURE__ */ t(
|
|
@@ -60,7 +64,7 @@ const z = ({
|
|
|
60
64
|
size: "medium",
|
|
61
65
|
matchParentWidth: !0,
|
|
62
66
|
buttonText: "Go live now",
|
|
63
|
-
isLoading:
|
|
67
|
+
isLoading: c,
|
|
64
68
|
onClick: d
|
|
65
69
|
}
|
|
66
70
|
) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoLiveModal.js","sources":["../../../../../src/components/agent-builder/components/GoLiveModal.tsx"],"sourcesContent":["import ManifestGlass from '@src/assets/icons/ManifestGlass.svg';\nimport SuccessIcon from '@src/assets/icons/successIcon.svg';\nimport { ArrowRight } from '@src/icons';\nimport React from 'react';\nimport { Button } from '@src/components/button';\nimport { StyledModal } from '@src/components/modals';\nimport { BodyPrimary, TitleMedium } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tDraftButtonScope,\n\tModalActions,\n\tModalBody,\n\tModalIcon,\n} from '../AgentBuilder.styled';\n\nexport type GoLiveModalMode = 'confirm' | 'success' | null;\n\ninterface GoLiveModalProps {\n\tmode: GoLiveModalMode;\n\tonClose: () => void;\n\tonConfirm: () => void;\n\tonSaveDraft: () => void;\n\tonGoToDashboard?: () => void;\n\tisPublishing?: boolean;\n}\n\n/**\n * Confirm / success dialog for going live. Uses `StyledModal` as the shell but\n * renders the actions INSIDE the body (not StyledModal's footer) — the footer's\n * `margin-top:auto` detaches from this short, centered hero layout and spills\n * out of the card. Body-level actions stay anchored under the content.\n */\nexport const GoLiveModal: React.FC<GoLiveModalProps> = ({\n\tmode,\n\tonClose,\n\tonConfirm,\n\tonSaveDraft,\n\tonGoToDashboard,\n\tisPublishing,\n}) => {\n\tif (!mode) {\n\t\treturn null;\n\t}\n\n\tconst isSuccess = mode === 'success';\n\n\treturn (\n\t\t<StyledModal\n\t\t\tdata-test=\"agent-go-live-modal\"\n\t\t\topen\n\t\t\tonClose={onClose}\n\t\t\twidth={isSuccess ? '400px' : '520px'}\n\t\t>\n\t\t\t<ModalBody>\n\t\t\t\t<ModalIcon>\n\t\t\t\t\t{isSuccess ? (\n\t\t\t\t\t\t<SuccessIcon width={64} height={64} />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<ManifestGlass width={64} height={64} />\n\t\t\t\t\t)}\n\t\t\t\t</ModalIcon>\n\n\t\t\t\t<TitleMedium color={COLORS.content.primary}>\n\t\t\t\t\t{isSuccess ? 'Your agent is live!' : 'Ready to go live?'}\n\t\t\t\t</TitleMedium>\n\t\t\t\t<BodyPrimary color={COLORS.content.secondary}>\n\t\t\t\t\t{isSuccess\n\t\t\t\t\t\t? 'You can manage your agents from the AI agent dashboard.'\n\t\t\t\t\t\t: 'This agent will start handling customer conversations immediately. You can pause it at any time.'}\n\t\t\t\t</BodyPrimary>\n\n\t\t\t\t<ModalActions>\n\t\t\t\t\t{isSuccess ? (\n\t\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tdata-test=\"agent-go-dashboard\"\n\t\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\tbuttonText=\"Go to Agent dashboard\"\n\t\t\t\t\t\t\t\tTrailingIcon={ArrowRight}\n\t\t\t\t\t\t\t\tonClick={onGoToDashboard ?? onClose}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<DraftButtonScope>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdata-test=\"agent-confirm-save-draft\"\n\t\t\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\t\tbuttonText=\"Save as draft\"\n\t\t\t\t\t\t\t\t\tonClick={onSaveDraft}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</DraftButtonScope>\n\t\t\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdata-test=\"agent-confirm-go-live\"\n\t\t\t\t\t\t\t\t\tbuttonType=\"primary\"\n\t\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\t\tbuttonText=\"Go live now\"\n\t\t\t\t\t\t\t\t\tisLoading={isPublishing}\n\t\t\t\t\t\t\t\t\tonClick={onConfirm}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t)}\n\t\t\t\t</ModalActions>\n\t\t\t</ModalBody>\n\t\t</StyledModal>\n\t);\n};\n"],"names":["GoLiveModal","mode","onClose","onConfirm","onSaveDraft","onGoToDashboard","isPublishing","isSuccess","jsx","StyledModal","ModalBody","ModalIcon","SuccessIcon","ManifestGlass","TitleMedium","COLORS","BodyPrimary","ModalActions","Button","ArrowRight","
|
|
1
|
+
{"version":3,"file":"GoLiveModal.js","sources":["../../../../../src/components/agent-builder/components/GoLiveModal.tsx"],"sourcesContent":["import ManifestGlass from '@src/assets/icons/ManifestGlass.svg';\nimport SuccessIcon from '@src/assets/icons/successIcon.svg';\nimport { ArrowRight } from '@src/icons';\nimport React from 'react';\nimport { Button } from '@src/components/button';\nimport { StyledModal } from '@src/components/modals';\nimport { BodyPrimary, TitleMedium } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tDraftButtonScope,\n\tModalActions,\n\tModalBody,\n\tModalIcon,\n} from '../AgentBuilder.styled';\n\nexport type GoLiveModalMode = 'confirm' | 'success' | null;\n\ninterface GoLiveModalProps {\n\tmode: GoLiveModalMode;\n\tonClose: () => void;\n\tonConfirm: () => void;\n\tonSaveDraft: () => void;\n\tonGoToDashboard?: () => void;\n\tisPublishing?: boolean;\n}\n\n/**\n * Confirm / success dialog for going live. Uses `StyledModal` as the shell but\n * renders the actions INSIDE the body (not StyledModal's footer) — the footer's\n * `margin-top:auto` detaches from this short, centered hero layout and spills\n * out of the card. Body-level actions stay anchored under the content.\n */\nexport const GoLiveModal: React.FC<GoLiveModalProps> = ({\n\tmode,\n\tonClose,\n\tonConfirm,\n\tonSaveDraft,\n\tonGoToDashboard,\n\tisPublishing,\n}) => {\n\tif (!mode) {\n\t\treturn null;\n\t}\n\n\tconst isSuccess = mode === 'success';\n\n\treturn (\n\t\t<StyledModal\n\t\t\tdata-test=\"agent-go-live-modal\"\n\t\t\topen\n\t\t\tonClose={onClose}\n\t\t\twidth={isSuccess ? '400px' : '520px'}\n\t\t>\n\t\t\t<ModalBody style={{ gap: '24px' }}>\n\t\t\t\t<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>\n\t\t\t\t\t<ModalIcon>\n\t\t\t\t\t\t{isSuccess ? (\n\t\t\t\t\t\t\t<SuccessIcon width={64} height={64} />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ManifestGlass width={64} height={64} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</ModalIcon>\n\n\t\t\t\t\t<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>\n\t\t\t\t\t\t<TitleMedium color={COLORS.content.primary}>\n\t\t\t\t\t\t\t{isSuccess ? 'Your agent is live!' : 'Ready to go live?'}\n\t\t\t\t\t\t</TitleMedium>\n\t\t\t\t\t\t<BodyPrimary color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t{isSuccess\n\t\t\t\t\t\t\t\t? 'You can manage your agents from the AI agent dashboard.'\n\t\t\t\t\t\t\t\t: 'This agent will start handling customer conversations immediately. You can pause it at any time.'}\n\t\t\t\t\t\t</BodyPrimary>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t<ModalActions>\n\t\t\t\t\t{isSuccess ? (\n\t\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tdata-test=\"agent-go-dashboard\"\n\t\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\tbuttonText=\"Go to Agent dashboard\"\n\t\t\t\t\t\t\t\tTrailingIcon={ArrowRight}\n\t\t\t\t\t\t\t\tonClick={onGoToDashboard ?? onClose}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<DraftButtonScope>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdata-test=\"agent-confirm-save-draft\"\n\t\t\t\t\t\t\t\t\tbuttonType=\"secondary\"\n\t\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\t\tbuttonText=\"Save as draft\"\n\t\t\t\t\t\t\t\t\tonClick={onSaveDraft}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</DraftButtonScope>\n\t\t\t\t\t\t\t<div style={{ display: 'flex' }}>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdata-test=\"agent-confirm-go-live\"\n\t\t\t\t\t\t\t\t\tbuttonType=\"primary\"\n\t\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\t\tmatchParentWidth\n\t\t\t\t\t\t\t\t\tbuttonText=\"Go live now\"\n\t\t\t\t\t\t\t\t\tisLoading={isPublishing}\n\t\t\t\t\t\t\t\t\tonClick={onConfirm}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t)}\n\t\t\t\t</ModalActions>\n\t\t\t</ModalBody>\n\t\t</StyledModal>\n\t);\n};\n"],"names":["GoLiveModal","mode","onClose","onConfirm","onSaveDraft","onGoToDashboard","isPublishing","isSuccess","jsx","StyledModal","ModalBody","jsxs","ModalIcon","SuccessIcon","ManifestGlass","TitleMedium","COLORS","BodyPrimary","ModalActions","Button","ArrowRight","Fragment","DraftButtonScope"],"mappings":";;;;;;;;;AAgCO,MAAMA,IAA0C,CAAC;AAAA,EACvD,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,cAAAC;AACD,MAAM;AACL,MAAI,CAACL;AACJ,WAAO;AAGR,QAAMM,IAAYN,MAAS;AAE3B,SACC,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,aAAU;AAAA,MACV,MAAI;AAAA,MACJ,SAAAP;AAAA,MACA,OAAOK,IAAY,UAAU;AAAA,MAE7B,4BAACG,GAAA,EAAU,OAAO,EAAE,KAAK,UACxB,UAAA;AAAA,QAAA,gBAAAC,EAAC,OAAA,EAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,KAAK,MAAA,GAC5D,UAAA;AAAA,UAAA,gBAAAH,EAACI,GAAA,EACC,UAAAL,IACA,gBAAAC,EAACK,GAAA,EAAY,OAAO,IAAI,QAAQ,IAAI,sBAEnCC,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AA,EAAA;AAGH;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as s, jsx as f } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as T, useState as J, useCallback as b, useEffect as E, useMemo as Y } from "react";
|
|
3
3
|
import { TitleSmall as $, BodyCaption as q } from "../../TypographyStyle.js";
|
|
4
|
-
import { COLORS as
|
|
4
|
+
import { COLORS as H } from "../../../constants/Theme.js";
|
|
5
5
|
import { FieldBlock as z, FieldLabelRow as I, AiTextAreaShell as Q } from "../AgentBuilder.styled.js";
|
|
6
6
|
import { AGENT_EDITOR_STYLE as U } from "../constants/editorStyle.js";
|
|
7
7
|
import { buildMentionHtml as V, instructionsToEditorHtml as W, editorDocToInstructions as X } from "../utils/mentionSerialization.js";
|
|
@@ -10,8 +10,8 @@ import { MentionPicker as K } from "./MentionPicker.js";
|
|
|
10
10
|
import { BikEditor as tt } from "../../../editor/BikEditor.js";
|
|
11
11
|
const rt = (a) => a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\r?\n/g, "<br>"), mt = ({
|
|
12
12
|
label: a,
|
|
13
|
-
value:
|
|
14
|
-
onChange:
|
|
13
|
+
value: e,
|
|
14
|
+
onChange: k,
|
|
15
15
|
maxLength: o,
|
|
16
16
|
placeholder: R,
|
|
17
17
|
minHeight: x = "200px",
|
|
@@ -19,31 +19,31 @@ const rt = (a) => a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "
|
|
|
19
19
|
mentionItems: i,
|
|
20
20
|
tools: O,
|
|
21
21
|
onMentionSelect: D,
|
|
22
|
-
onFocus:
|
|
22
|
+
onFocus: L,
|
|
23
23
|
registerInsert: c,
|
|
24
|
-
onCreateSubAgent:
|
|
25
|
-
toolActions:
|
|
26
|
-
integrationStatus:
|
|
27
|
-
onConnectIntegration:
|
|
24
|
+
onCreateSubAgent: M,
|
|
25
|
+
toolActions: y,
|
|
26
|
+
integrationStatus: A,
|
|
27
|
+
onConnectIntegration: B,
|
|
28
28
|
action: P,
|
|
29
29
|
...j
|
|
30
30
|
}) => {
|
|
31
|
-
const l = T(null), [w, p] = J(
|
|
31
|
+
const l = T(null), [w, p] = J(e.length), d = T(e.length), F = b(
|
|
32
32
|
({ text: t }) => {
|
|
33
33
|
if (!t)
|
|
34
34
|
return !1;
|
|
35
|
-
const r = l.current, m = r?.getSelectedText().length ?? 0,
|
|
36
|
-
return t.length <=
|
|
35
|
+
const r = l.current, m = r?.getSelectedText().length ?? 0, n = o - (d.current - m);
|
|
36
|
+
return t.length <= n ? !1 : (n <= 0 || r?.insertContent(rt(t.slice(0, n))), !0);
|
|
37
37
|
},
|
|
38
38
|
[o]
|
|
39
39
|
), g = b(
|
|
40
|
-
(t, r, m,
|
|
40
|
+
(t, r, m, n) => {
|
|
41
41
|
const h = l.current;
|
|
42
42
|
if (!h)
|
|
43
43
|
return;
|
|
44
44
|
const S = i.find(
|
|
45
45
|
(C) => String(C.id) === String(r) && C.meta?.kind === t
|
|
46
|
-
), _ = m ?? S?.label ?? r, G =
|
|
46
|
+
), _ = m ?? S?.label ?? r, G = n ?? S?.meta?.source;
|
|
47
47
|
h.insertInlineContent(
|
|
48
48
|
`${V(String(r), _, t, G)} `
|
|
49
49
|
);
|
|
@@ -55,20 +55,20 @@ const rt = (a) => a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "
|
|
|
55
55
|
return c(g), () => c(null);
|
|
56
56
|
}, [c, g]);
|
|
57
57
|
const N = Y(
|
|
58
|
-
() => W(
|
|
58
|
+
() => W(e, i),
|
|
59
59
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
60
|
[u]
|
|
61
61
|
);
|
|
62
62
|
return E(
|
|
63
63
|
() => {
|
|
64
|
-
p(
|
|
64
|
+
p(e.length), d.current = e.length;
|
|
65
65
|
},
|
|
66
66
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
67
|
[u]
|
|
68
68
|
), /* @__PURE__ */ s(z, { children: [
|
|
69
69
|
/* @__PURE__ */ s(I, { children: [
|
|
70
|
-
/* @__PURE__ */ f($, { color:
|
|
71
|
-
/* @__PURE__ */ s(q, { color:
|
|
70
|
+
/* @__PURE__ */ f($, { color: H.content.primary, children: a }),
|
|
71
|
+
/* @__PURE__ */ s(q, { color: H.content.secondary, children: [
|
|
72
72
|
w,
|
|
73
73
|
"/",
|
|
74
74
|
o
|
|
@@ -82,12 +82,13 @@ const rt = (a) => a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "
|
|
|
82
82
|
initialContent: N,
|
|
83
83
|
placeholder: R,
|
|
84
84
|
characterLimit: o,
|
|
85
|
+
characterLimitHard: !0,
|
|
85
86
|
onPaste: F,
|
|
86
87
|
minHeight: "120px",
|
|
87
88
|
maxHeight: "320px",
|
|
88
89
|
style: { border: "none" },
|
|
89
90
|
editorStyle: U,
|
|
90
|
-
onFocus:
|
|
91
|
+
onFocus: L,
|
|
91
92
|
mentions: {
|
|
92
93
|
agents: i,
|
|
93
94
|
removeTriggerOnDismiss: !0,
|
|
@@ -98,10 +99,10 @@ const rt = (a) => a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "
|
|
|
98
99
|
K,
|
|
99
100
|
{
|
|
100
101
|
...t,
|
|
101
|
-
onCreateSubAgent:
|
|
102
|
-
toolActions:
|
|
103
|
-
integrationStatus:
|
|
104
|
-
onConnectIntegration:
|
|
102
|
+
onCreateSubAgent: M,
|
|
103
|
+
toolActions: y,
|
|
104
|
+
integrationStatus: A,
|
|
105
|
+
onConnectIntegration: B
|
|
105
106
|
}
|
|
106
107
|
),
|
|
107
108
|
onSelect: (t) => {
|
|
@@ -112,7 +113,7 @@ const rt = (a) => a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "
|
|
|
112
113
|
onChange: (t) => {
|
|
113
114
|
p(t.characterCount), d.current = t.characterCount;
|
|
114
115
|
const r = l.current?.getJSON() ?? null;
|
|
115
|
-
|
|
116
|
+
k(X(r, O));
|
|
116
117
|
}
|
|
117
118
|
},
|
|
118
119
|
u
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentionEditor.js","sources":["../../../../../src/components/agent-builder/components/MentionEditor.tsx"],"sourcesContent":["import { BikEditor, BikEditorRef, MentionItem, PasteData } from '@src/editor';\nimport React, {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentTool } from '../AgentBuilder.model';\nimport {\n\tAiTextAreaShell,\n\tFieldBlock,\n\tFieldLabelRow,\n} from '../AgentBuilder.styled';\nimport { AGENT_EDITOR_STYLE } from '../constants/editorStyle';\nimport type { ToolAction, ToolSource } from '../constants/tools';\nimport {\n\tbuildMentionHtml,\n\teditorDocToInstructions,\n\tinstructionsToEditorHtml,\n\tMentionKindMeta,\n} from '../utils/mentionSerialization';\nimport { renderSourceIcon, sourceIcon } from '../utils/sourceIcons';\nimport { MentionPicker } from './MentionPicker';\n\ntype InsertFn = (\n\tkind: 'tool' | 'subagent',\n\tid: string,\n\tlabel?: string,\n\tsource?: string,\n) => void;\n\n// Insert-safe HTML for a plain-text run: escape entities so pasted text is never\n// interpreted as markup, and keep line breaks (mirrors the plain-paste pipeline).\nconst plainTextToHtml = (text: string): string =>\n\ttext\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/\\r?\\n/g, '<br>');\n\ninterface MentionEditorProps {\n\tlabel: string;\n\tvalue: string;\n\tonChange: (text: string) => void;\n\tmaxLength: number;\n\tplaceholder?: string;\n\tminHeight?: string;\n\t/** Changing this remounts the editor with fresh content. */\n\tresetKey?: string | number;\n\t/** Items shown in the `@` picker (tools, and sub-agents where allowed). */\n\tmentionItems: MentionItem[];\n\t/** Tools used to serialise mention nodes back to `{{tool:KEY}}`. */\n\ttools: AgentTool[];\n\t/** Called when an item is picked from the `@` menu (to attach it upstream). */\n\tonMentionSelect?: (kind: 'tool' | 'subagent', id: string) => void;\n\tonFocus?: () => void;\n\t/** Receives an insert-at-cursor fn (and null on unmount) for side-panel adds. */\n\tregisterInsert?: (fn: InsertFn | null) => void;\n\t/**\n\t * When set, the `@` picker's Sub-agent view shows a \"Create new\" row that calls\n\t * this (opens the create-sub-agent drawer). Omit to hide it (e.g. the drawer's\n\t * own editors, which can't nest sub-agents).\n\t */\n\tonCreateSubAgent?: () => void;\n\t/**\n\t * Built-in tool actions (Rest API / Handover to email) shown in the `@` picker's\n\t * Tools view. Picking one opens its drawer instead of inserting a mention.\n\t */\n\ttoolActions?: ToolAction[];\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>;\n\tonConnectIntegration?: (source: ToolSource) => void;\n\t/** Optional action(s) rendered inside the shell, below the editor. */\n\taction?: React.ReactNode;\n\t'data-test'?: string;\n}\n\n/**\n * Presentational BikEditor field with `@` mentions. Stores firebase token text\n * (`{{tool:KEY}}` / `{{subagent:ID}}`). Context-free — both the builder's\n * Step-3 fields and the create-sub-agent drawer compose it.\n */\nexport const MentionEditor: React.FC<MentionEditorProps> = ({\n\tlabel,\n\tvalue,\n\tonChange,\n\tmaxLength,\n\tplaceholder,\n\tminHeight = '200px',\n\tresetKey,\n\tmentionItems,\n\ttools,\n\tonMentionSelect,\n\tonFocus,\n\tregisterInsert,\n\tonCreateSubAgent,\n\ttoolActions,\n\tintegrationStatus,\n\tonConnectIntegration,\n\taction,\n\t...rest\n}) => {\n\tconst editorRef = useRef<BikEditorRef>(null);\n\tconst [count, setCount] = useState(value.length);\n\t// Live character count for the paste handler (BikEditor captures onPaste once\n\t// at mount, so it can't read the `count` state without going stale).\n\tconst countRef = useRef(value.length);\n\n\t// On paste, insert only the characters that still fit under the limit instead\n\t// of letting the paste overflow. Pastes that fit fall through to the editor's\n\t// normal (break-preserving) plain-paste pipeline.\n\tconst handlePaste = useCallback(\n\t\t({ text }: PasteData): boolean | void => {\n\t\t\tif (!text) {\n\t\t\t\treturn false; // non-text (e.g. images) → default handling\n\t\t\t}\n\t\t\tconst editor = editorRef.current;\n\t\t\tconst selectionLength = editor?.getSelectedText().length ?? 0;\n\t\t\tconst room = maxLength - (countRef.current - selectionLength);\n\t\t\tif (text.length <= room) {\n\t\t\t\treturn false; // fits → let the default plain-paste pipeline run\n\t\t\t}\n\t\t\tif (room <= 0) {\n\t\t\t\treturn true; // already full → drop the paste\n\t\t\t}\n\t\t\teditor?.insertContent(plainTextToHtml(text.slice(0, room)));\n\t\t\treturn true;\n\t\t},\n\t\t[maxLength],\n\t);\n\n\tconst insert = useCallback<InsertFn>(\n\t\t(kind, id, overrideLabel, overrideSource) => {\n\t\t\tconst editor = editorRef.current;\n\t\t\tif (!editor) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst item = mentionItems.find(\n\t\t\t\t(m) =>\n\t\t\t\t\tString(m.id) === String(id) &&\n\t\t\t\t\t(m.meta as unknown as MentionKindMeta | undefined)?.kind === kind,\n\t\t\t);\n\t\t\tconst finalLabel = overrideLabel ?? item?.label ?? id;\n\t\t\t// Prefer the caller-supplied source: a JUST-created custom tool (Rest API /\n\t\t\t// email / Slack) isn't in `mentionItems` yet, so the lookup would miss and\n\t\t\t// the chip would render without its icon until reload.\n\t\t\tconst source =\n\t\t\t\toverrideSource ??\n\t\t\t\t(item?.meta as unknown as MentionKindMeta | undefined)?.source;\n\t\t\teditor.insertInlineContent(\n\t\t\t\t`${buildMentionHtml(String(id), finalLabel, kind, source)} `,\n\t\t\t);\n\t\t},\n\t\t[mentionItems],\n\t);\n\n\tuseEffect(() => {\n\t\tif (!registerInsert) {\n\t\t\treturn;\n\t\t}\n\t\tregisterInsert(insert);\n\t\treturn () => registerInsert(null);\n\t}, [registerInsert, insert]);\n\n\t// Mount-only initial HTML; recomputed (editor remounted via key) on resetKey.\n\tconst initialHtml = useMemo(\n\t\t() => instructionsToEditorHtml(value, mentionItems),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[resetKey],\n\t);\n\n\tuseEffect(\n\t\t() => {\n\t\t\tsetCount(value.length);\n\t\t\tcountRef.current = value.length;\n\t\t},\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[resetKey],\n\t);\n\n\treturn (\n\t\t<FieldBlock>\n\t\t\t<FieldLabelRow>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>{label}</TitleSmall>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t{count}/{maxLength}\n\t\t\t\t</BodyCaption>\n\t\t\t</FieldLabelRow>\n\n\t\t\t<AiTextAreaShell minHeight={minHeight} data-test={rest['data-test']}>\n\t\t\t\t<BikEditor\n\t\t\t\t\tkey={resetKey}\n\t\t\t\t\tref={editorRef}\n\t\t\t\t\tinitialContent={initialHtml}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t// Soft limit: blocks typing past the cap; `onPaste` truncates a\n\t\t\t\t\t// paste to what still fits, and any residual overflow renders grey.\n\t\t\t\t\tcharacterLimit={maxLength}\n\t\t\t\t\tonPaste={handlePaste}\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\tmaxHeight=\"320px\"\n\t\t\t\t\tstyle={{ border: 'none' }}\n\t\t\t\t\teditorStyle={AGENT_EDITOR_STYLE}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tmentions={{\n\t\t\t\t\t\tagents: mentionItems,\n\t\t\t\t\t\tremoveTriggerOnDismiss: true,\n\t\t\t\t\t\t// Tool chips lead with their source glyph (manifest / shopify / …);\n\t\t\t\t\t\t// sub-agent chips have no source, so no icon.\n\t\t\t\t\t\trenderChipIcon: (source) =>\n\t\t\t\t\t\t\trenderSourceIcon(sourceIcon(source ?? undefined), -6),\n\t\t\t\t\t\trenderDropdown: (props) => (\n\t\t\t\t\t\t\t<MentionPicker\n\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\tonCreateSubAgent={onCreateSubAgent}\n\t\t\t\t\t\t\t\ttoolActions={toolActions}\n\t\t\t\t\t\t\t\tintegrationStatus={integrationStatus}\n\t\t\t\t\t\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t\tonSelect: (item) => {\n\t\t\t\t\t\t\tconst kind = (item.meta as unknown as MentionKindMeta | undefined)\n\t\t\t\t\t\t\t\t?.kind;\n\t\t\t\t\t\t\tif (kind) {\n\t\t\t\t\t\t\t\tonMentionSelect?.(kind, String(item.id));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t\tonChange={(snapshot) => {\n\t\t\t\t\t\tsetCount(snapshot.characterCount);\n\t\t\t\t\t\tcountRef.current = snapshot.characterCount;\n\t\t\t\t\t\tconst doc = editorRef.current?.getJSON() ?? null;\n\t\t\t\t\t\tonChange(editorDocToInstructions(doc, tools));\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t{action}\n\t\t\t</AiTextAreaShell>\n\t\t</FieldBlock>\n\t);\n};\n"],"names":["plainTextToHtml","text","MentionEditor","label","value","onChange","maxLength","placeholder","minHeight","resetKey","mentionItems","tools","onMentionSelect","onFocus","registerInsert","onCreateSubAgent","toolActions","integrationStatus","onConnectIntegration","action","rest","editorRef","useRef","count","setCount","useState","countRef","handlePaste","useCallback","editor","selectionLength","room","insert","kind","id","overrideLabel","overrideSource","item","m","finalLabel","source","buildMentionHtml","useEffect","initialHtml","useMemo","instructionsToEditorHtml","FieldBlock","jsxs","FieldLabelRow","jsx","TitleSmall","COLORS","BodyCaption","AiTextAreaShell","BikEditor","AGENT_EDITOR_STYLE","renderSourceIcon","sourceIcon","props","MentionPicker","snapshot","doc","editorDocToInstructions"],"mappings":";;;;;;;;;;AAoCA,MAAMA,KAAkB,CAACC,MACxBA,EACE,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM,EACpB,QAAQ,UAAU,MAA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B,MAChBgB,EAAiBC,EAAWjB,KAAU,MAAS,GAAG,EAAE;AAAA,YACrD,gBAAgB,CAACkB,MAChB,gBAAAT;AAAA,cAACU;AAAA,cAAA;AAAA,gBACC,GAAGD;AAAA,gBACJ,kBAAA3C;AAAA,gBACA,aAAAC;AAAA,gBACA,mBAAAC;AAAA,gBACA,sBAAAC;AAAA,cAAA;AAAA,YAAA;AAAA,YAGF,UAAU,CAACmB,MAAS;AACnB,oBAAMJ,IAAQI,EAAK,MAChB;AACH,cAAIJ,KACHrB,IAAkBqB,GAAM,OAAOI,EAAK,EAAE,CAAC;AAAA,YAEzC;AAAA,UAAA;AAAA,UAED,UAAU,CAACuB,MAAa;AACvB,YAAApC,EAASoC,EAAS,cAAc,GAChClC,EAAS,UAAUkC,EAAS;AAC5B,kBAAMC,IAAMxC,EAAU,SAAS,QAAA,KAAa;AAC5C,YAAAhB,EAASyD,EAAwBD,GAAKlD,CAAK,CAAC;AAAA,UAC7C;AAAA,QAAA;AAAA,QA1CKF;AAAA,MAAA;AAAA,MA4CLU;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACD;AAEF;"}
|
|
1
|
+
{"version":3,"file":"MentionEditor.js","sources":["../../../../../src/components/agent-builder/components/MentionEditor.tsx"],"sourcesContent":["import { BikEditor, BikEditorRef, MentionItem, PasteData } from '@src/editor';\nimport React, {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentTool } from '../AgentBuilder.model';\nimport {\n\tAiTextAreaShell,\n\tFieldBlock,\n\tFieldLabelRow,\n} from '../AgentBuilder.styled';\nimport { AGENT_EDITOR_STYLE } from '../constants/editorStyle';\nimport type { ToolAction, ToolSource } from '../constants/tools';\nimport {\n\tbuildMentionHtml,\n\teditorDocToInstructions,\n\tinstructionsToEditorHtml,\n\tMentionKindMeta,\n} from '../utils/mentionSerialization';\nimport { renderSourceIcon, sourceIcon } from '../utils/sourceIcons';\nimport { MentionPicker } from './MentionPicker';\n\ntype InsertFn = (\n\tkind: 'tool' | 'subagent',\n\tid: string,\n\tlabel?: string,\n\tsource?: string,\n) => void;\n\n// Insert-safe HTML for a plain-text run: escape entities so pasted text is never\n// interpreted as markup, and keep line breaks (mirrors the plain-paste pipeline).\nconst plainTextToHtml = (text: string): string =>\n\ttext\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/\\r?\\n/g, '<br>');\n\ninterface MentionEditorProps {\n\tlabel: string;\n\tvalue: string;\n\tonChange: (text: string) => void;\n\tmaxLength: number;\n\tplaceholder?: string;\n\tminHeight?: string;\n\t/** Changing this remounts the editor with fresh content. */\n\tresetKey?: string | number;\n\t/** Items shown in the `@` picker (tools, and sub-agents where allowed). */\n\tmentionItems: MentionItem[];\n\t/** Tools used to serialise mention nodes back to `{{tool:KEY}}`. */\n\ttools: AgentTool[];\n\t/** Called when an item is picked from the `@` menu (to attach it upstream). */\n\tonMentionSelect?: (kind: 'tool' | 'subagent', id: string) => void;\n\tonFocus?: () => void;\n\t/** Receives an insert-at-cursor fn (and null on unmount) for side-panel adds. */\n\tregisterInsert?: (fn: InsertFn | null) => void;\n\t/**\n\t * When set, the `@` picker's Sub-agent view shows a \"Create new\" row that calls\n\t * this (opens the create-sub-agent drawer). Omit to hide it (e.g. the drawer's\n\t * own editors, which can't nest sub-agents).\n\t */\n\tonCreateSubAgent?: () => void;\n\t/**\n\t * Built-in tool actions (Rest API / Handover to email) shown in the `@` picker's\n\t * Tools view. Picking one opens its drawer instead of inserting a mention.\n\t */\n\ttoolActions?: ToolAction[];\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>;\n\tonConnectIntegration?: (source: ToolSource) => void;\n\t/** Optional action(s) rendered inside the shell, below the editor. */\n\taction?: React.ReactNode;\n\t'data-test'?: string;\n}\n\n/**\n * Presentational BikEditor field with `@` mentions. Stores firebase token text\n * (`{{tool:KEY}}` / `{{subagent:ID}}`). Context-free — both the builder's\n * Step-3 fields and the create-sub-agent drawer compose it.\n */\nexport const MentionEditor: React.FC<MentionEditorProps> = ({\n\tlabel,\n\tvalue,\n\tonChange,\n\tmaxLength,\n\tplaceholder,\n\tminHeight = '200px',\n\tresetKey,\n\tmentionItems,\n\ttools,\n\tonMentionSelect,\n\tonFocus,\n\tregisterInsert,\n\tonCreateSubAgent,\n\ttoolActions,\n\tintegrationStatus,\n\tonConnectIntegration,\n\taction,\n\t...rest\n}) => {\n\tconst editorRef = useRef<BikEditorRef>(null);\n\tconst [count, setCount] = useState(value.length);\n\t// Live character count for the paste handler (BikEditor captures onPaste once\n\t// at mount, so it can't read the `count` state without going stale).\n\tconst countRef = useRef(value.length);\n\n\t// On paste, insert only the characters that still fit under the limit instead\n\t// of letting the paste overflow. Pastes that fit fall through to the editor's\n\t// normal (break-preserving) plain-paste pipeline.\n\tconst handlePaste = useCallback(\n\t\t({ text }: PasteData): boolean | void => {\n\t\t\tif (!text) {\n\t\t\t\treturn false; // non-text (e.g. images) → default handling\n\t\t\t}\n\t\t\tconst editor = editorRef.current;\n\t\t\tconst selectionLength = editor?.getSelectedText().length ?? 0;\n\t\t\tconst room = maxLength - (countRef.current - selectionLength);\n\t\t\tif (text.length <= room) {\n\t\t\t\treturn false; // fits → let the default plain-paste pipeline run\n\t\t\t}\n\t\t\tif (room <= 0) {\n\t\t\t\treturn true; // already full → drop the paste\n\t\t\t}\n\t\t\teditor?.insertContent(plainTextToHtml(text.slice(0, room)));\n\t\t\treturn true;\n\t\t},\n\t\t[maxLength],\n\t);\n\n\tconst insert = useCallback<InsertFn>(\n\t\t(kind, id, overrideLabel, overrideSource) => {\n\t\t\tconst editor = editorRef.current;\n\t\t\tif (!editor) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst item = mentionItems.find(\n\t\t\t\t(m) =>\n\t\t\t\t\tString(m.id) === String(id) &&\n\t\t\t\t\t(m.meta as unknown as MentionKindMeta | undefined)?.kind === kind,\n\t\t\t);\n\t\t\tconst finalLabel = overrideLabel ?? item?.label ?? id;\n\t\t\t// Prefer the caller-supplied source: a JUST-created custom tool (Rest API /\n\t\t\t// email / Slack) isn't in `mentionItems` yet, so the lookup would miss and\n\t\t\t// the chip would render without its icon until reload.\n\t\t\tconst source =\n\t\t\t\toverrideSource ??\n\t\t\t\t(item?.meta as unknown as MentionKindMeta | undefined)?.source;\n\t\t\teditor.insertInlineContent(\n\t\t\t\t`${buildMentionHtml(String(id), finalLabel, kind, source)} `,\n\t\t\t);\n\t\t},\n\t\t[mentionItems],\n\t);\n\n\tuseEffect(() => {\n\t\tif (!registerInsert) {\n\t\t\treturn;\n\t\t}\n\t\tregisterInsert(insert);\n\t\treturn () => registerInsert(null);\n\t}, [registerInsert, insert]);\n\n\t// Mount-only initial HTML; recomputed (editor remounted via key) on resetKey.\n\tconst initialHtml = useMemo(\n\t\t() => instructionsToEditorHtml(value, mentionItems),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[resetKey],\n\t);\n\n\tuseEffect(\n\t\t() => {\n\t\t\tsetCount(value.length);\n\t\t\tcountRef.current = value.length;\n\t\t},\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[resetKey],\n\t);\n\n\treturn (\n\t\t<FieldBlock>\n\t\t\t<FieldLabelRow>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>{label}</TitleSmall>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t{count}/{maxLength}\n\t\t\t\t</BodyCaption>\n\t\t\t</FieldLabelRow>\n\n\t\t\t<AiTextAreaShell minHeight={minHeight} data-test={rest['data-test']}>\n\t\t\t\t<BikEditor\n\t\t\t\t\tkey={resetKey}\n\t\t\t\t\tref={editorRef}\n\t\t\t\t\tinitialContent={initialHtml}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t// Hard limit: nothing may push the content past the cap. Typing,\n\t\t\t\t\t// Enter and drop past it are rejected; a paste is truncated to fill\n\t\t\t\t\t// the remaining room (`onPaste` pre-trims; the hard filter trims any\n\t\t\t\t\t// residue). Content loaded over the cap is kept and can only shrink.\n\t\t\t\t\t// Same metric as the shown count.\n\t\t\t\t\tcharacterLimit={maxLength}\n\t\t\t\t\tcharacterLimitHard\n\t\t\t\t\tonPaste={handlePaste}\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\tmaxHeight=\"320px\"\n\t\t\t\t\tstyle={{ border: 'none' }}\n\t\t\t\t\teditorStyle={AGENT_EDITOR_STYLE}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tmentions={{\n\t\t\t\t\t\tagents: mentionItems,\n\t\t\t\t\t\tremoveTriggerOnDismiss: true,\n\t\t\t\t\t\t// Tool chips lead with their source glyph (manifest / shopify / …);\n\t\t\t\t\t\t// sub-agent chips have no source, so no icon.\n\t\t\t\t\t\trenderChipIcon: (source) =>\n\t\t\t\t\t\t\trenderSourceIcon(sourceIcon(source ?? undefined), -6),\n\t\t\t\t\t\trenderDropdown: (props) => (\n\t\t\t\t\t\t\t<MentionPicker\n\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t\tonCreateSubAgent={onCreateSubAgent}\n\t\t\t\t\t\t\t\ttoolActions={toolActions}\n\t\t\t\t\t\t\t\tintegrationStatus={integrationStatus}\n\t\t\t\t\t\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t\tonSelect: (item) => {\n\t\t\t\t\t\t\tconst kind = (item.meta as unknown as MentionKindMeta | undefined)\n\t\t\t\t\t\t\t\t?.kind;\n\t\t\t\t\t\t\tif (kind) {\n\t\t\t\t\t\t\t\tonMentionSelect?.(kind, String(item.id));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t\tonChange={(snapshot) => {\n\t\t\t\t\t\tsetCount(snapshot.characterCount);\n\t\t\t\t\t\tcountRef.current = snapshot.characterCount;\n\t\t\t\t\t\tconst doc = editorRef.current?.getJSON() ?? null;\n\t\t\t\t\t\tonChange(editorDocToInstructions(doc, tools));\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t{action}\n\t\t\t</AiTextAreaShell>\n\t\t</FieldBlock>\n\t);\n};\n"],"names":["plainTextToHtml","text","MentionEditor","label","value","onChange","maxLength","placeholder","minHeight","resetKey","mentionItems","tools","onMentionSelect","onFocus","registerInsert","onCreateSubAgent","toolActions","integrationStatus","onConnectIntegration","action","rest","editorRef","useRef","count","setCount","useState","countRef","handlePaste","useCallback","editor","selectionLength","room","insert","kind","id","overrideLabel","overrideSource","item","m","finalLabel","source","buildMentionHtml","useEffect","initialHtml","useMemo","instructionsToEditorHtml","FieldBlock","jsxs","FieldLabelRow","jsx","TitleSmall","COLORS","BodyCaption","AiTextAreaShell","BikEditor","AGENT_EDITOR_STYLE","renderSourceIcon","sourceIcon","props","MentionPicker","snapshot","doc","editorDocToInstructions"],"mappings":";;;;;;;;;;AAoCA,MAAMA,KAAkB,CAACC,MACxBA,EACE,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM,EACpB,QAAQ,UAAU,MAAM,GA2CdC,KAA8C,CAAC;AAAA,EAC3D,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,OAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,GAAGC;AACJ,MAAM;AACL,QAAMC,IAAYC,EAAqB,IAAI,GACrC,CAACC,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