@bikdotai/bik-component-library 0.0.830 → 0.0.831-beta.1
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/AgentBuilder.js +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +17 -65
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +41 -0
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/DrawerHeaderText.js +15 -0
- package/dist/cjs/components/agent-builder/components/DrawerHeaderText.js.map +1 -0
- 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/MentionField.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionPicker.js +20 -20
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +23 -0
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js +5 -5
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js +5 -0
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js.map +1 -0
- package/dist/cjs/components/agent-builder/constants/tools.js +2 -0
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -0
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +3 -3
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/cjs/components/side-modal/SideModal.style.js +11 -10
- package/dist/cjs/components/side-modal/SideModal.style.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.js +100 -96
- package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +144 -1
- package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +0 -21
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js +42 -111
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.d.ts +33 -0
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +251 -0
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -0
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +9 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +318 -219
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/DrawerHeaderText.d.ts +33 -0
- package/dist/esm/components/agent-builder/components/DrawerHeaderText.js +42 -0
- package/dist/esm/components/agent-builder/components/DrawerHeaderText.js.map +1 -0
- package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +6 -0
- package/dist/esm/components/agent-builder/components/MentionEditor.js +38 -30
- package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionField.js +76 -51
- package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +7 -0
- package/dist/esm/components/agent-builder/components/MentionPicker.js +162 -145
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +27 -0
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +270 -0
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -0
- package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +14 -0
- package/dist/esm/components/agent-builder/components/SelectableListSection.js +166 -140
- package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.d.ts +19 -0
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +66 -0
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -0
- package/dist/esm/components/agent-builder/constants/tools.d.ts +77 -0
- package/dist/esm/components/agent-builder/constants/tools.js +34 -0
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -0
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +19 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +169 -140
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/index.d.ts +2 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +241 -141
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +18 -3
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js +81 -62
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +15 -9
- package/dist/esm/components/agent-builder/utils/sourceIcons.js +16 -8
- package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/esm/components/side-modal/SideModal.style.js +1 -0
- package/dist/esm/components/side-modal/SideModal.style.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionExtension.js +60 -57
- package/dist/esm/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/esm/index.js +97 -95
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,52 +1,55 @@
|
|
|
1
|
-
import { mergeAttributes as
|
|
2
|
-
import
|
|
3
|
-
import { ReactRenderer as
|
|
4
|
-
import { createSuggestionPopup as
|
|
5
|
-
import { MentionDropdown as
|
|
6
|
-
function
|
|
7
|
-
const { renderItem:
|
|
1
|
+
import { mergeAttributes as f } from "../../../node_modules/@tiptap/core/dist/index.js";
|
|
2
|
+
import k from "@tiptap/extension-mention";
|
|
3
|
+
import { ReactRenderer as b } from "@tiptap/react";
|
|
4
|
+
import { createSuggestionPopup as w } from "../suggestionPopup.js";
|
|
5
|
+
import { MentionDropdown as p } from "./MentionDropdown.js";
|
|
6
|
+
function h(d, r) {
|
|
7
|
+
const { renderItem: o, renderDropdown: a, removeTriggerOnDismiss: s } = d;
|
|
8
8
|
return () => {
|
|
9
|
-
let u,
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
const { editor:
|
|
13
|
-
|
|
9
|
+
let u, i, e, t = null;
|
|
10
|
+
const l = () => {
|
|
11
|
+
if (r.picked = !0, e?.editor && e?.range) {
|
|
12
|
+
const { editor: n, range: c } = e;
|
|
13
|
+
n.chain().focus().deleteRange(c).run();
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
return {
|
|
17
|
-
onStart: (
|
|
18
|
-
e =
|
|
19
|
-
props: { ...
|
|
20
|
-
editor:
|
|
21
|
-
}),
|
|
17
|
+
onStart: (n) => {
|
|
18
|
+
e = n, r.picked = !1, u = new b(p, {
|
|
19
|
+
props: { ...n, renderItem: o, renderDropdown: a, dismiss: l },
|
|
20
|
+
editor: n.editor
|
|
21
|
+
}), i = w(u.element, n.clientRect), t = (c) => {
|
|
22
|
+
const m = c.target;
|
|
23
|
+
!m || i.element.contains(m) || e?.editor?.view?.dom?.contains(m) || (r.picked = !0, e?.editor && e?.range && e.editor.chain().deleteRange(e.range).run(), i.hide());
|
|
24
|
+
}, document.addEventListener("mousedown", t);
|
|
22
25
|
},
|
|
23
|
-
onUpdate: (
|
|
24
|
-
if (e =
|
|
25
|
-
...
|
|
26
|
-
renderItem:
|
|
26
|
+
onUpdate: (n) => {
|
|
27
|
+
if (e = n, u.updateProps({
|
|
28
|
+
...n,
|
|
29
|
+
renderItem: o,
|
|
27
30
|
renderDropdown: a,
|
|
28
|
-
dismiss:
|
|
29
|
-
}), !
|
|
30
|
-
|
|
31
|
+
dismiss: l
|
|
32
|
+
}), !n.items?.length) {
|
|
33
|
+
i.hide();
|
|
31
34
|
return;
|
|
32
35
|
}
|
|
33
|
-
|
|
36
|
+
i.show(), i.updatePosition(n.clientRect);
|
|
34
37
|
},
|
|
35
|
-
onKeyDown: (
|
|
38
|
+
onKeyDown: (n) => n.event.key === "Escape" ? (i.hide(), !0) : u.ref?.onKeyDown(n) ?? !1,
|
|
36
39
|
onExit: () => {
|
|
37
|
-
if (
|
|
38
|
-
const { editor:
|
|
40
|
+
if (t && (document.removeEventListener("mousedown", t), t = null), i.destroy(), u.destroy(), s && !r.picked && e?.editor && e?.range) {
|
|
41
|
+
const { editor: n, range: c } = e;
|
|
39
42
|
setTimeout(() => {
|
|
40
|
-
|
|
43
|
+
n.isDestroyed || n.chain().deleteRange(c).run();
|
|
41
44
|
}, 0);
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
};
|
|
45
48
|
};
|
|
46
49
|
}
|
|
47
|
-
function
|
|
48
|
-
const
|
|
49
|
-
return
|
|
50
|
+
function g(d, r, o, a, s, u) {
|
|
51
|
+
const i = { picked: !1 };
|
|
52
|
+
return k.extend({
|
|
50
53
|
name: d,
|
|
51
54
|
addAttributes() {
|
|
52
55
|
return {
|
|
@@ -59,58 +62,58 @@ function c(d, i, r, a, s, u) {
|
|
|
59
62
|
};
|
|
60
63
|
}
|
|
61
64
|
}).configure({
|
|
62
|
-
HTMLAttributes: { class:
|
|
63
|
-
renderText: ({ options: e, node:
|
|
64
|
-
renderHTML: ({ options: e, node:
|
|
65
|
+
HTMLAttributes: { class: r },
|
|
66
|
+
renderText: ({ options: e, node: t }) => `${t.attrs.kind ? "" : e.suggestion.char}${t.attrs.label}`,
|
|
67
|
+
renderHTML: ({ options: e, node: t }) => [
|
|
65
68
|
"span",
|
|
66
|
-
|
|
69
|
+
f(
|
|
67
70
|
e.HTMLAttributes,
|
|
68
|
-
|
|
71
|
+
t.attrs.kind ? { "data-kind": String(t.attrs.kind) } : {}
|
|
69
72
|
),
|
|
70
|
-
`${
|
|
73
|
+
`${t.attrs.kind ? "" : e.suggestion.char}${t.attrs.label}`
|
|
71
74
|
],
|
|
72
75
|
suggestion: {
|
|
73
|
-
char:
|
|
76
|
+
char: o,
|
|
74
77
|
allowSpaces: !0,
|
|
75
78
|
items: ({ query: e }) => a.current.filter(
|
|
76
|
-
(
|
|
79
|
+
(t) => t.label.toLowerCase().includes(e.toLowerCase())
|
|
77
80
|
),
|
|
78
|
-
command: ({ editor: e, range:
|
|
79
|
-
|
|
81
|
+
command: ({ editor: e, range: t, props: l }) => {
|
|
82
|
+
i.picked = !0, e.chain().focus().deleteRange(t).insertContent({
|
|
80
83
|
type: d,
|
|
81
84
|
attrs: {
|
|
82
|
-
id:
|
|
83
|
-
label:
|
|
84
|
-
kind:
|
|
85
|
+
id: l.id,
|
|
86
|
+
label: l.label,
|
|
87
|
+
kind: l.meta?.kind ?? null
|
|
85
88
|
}
|
|
86
|
-
}).run(), s?.(
|
|
89
|
+
}).run(), s?.(l, o);
|
|
87
90
|
},
|
|
88
|
-
render:
|
|
91
|
+
render: h(u, i)
|
|
89
92
|
}
|
|
90
93
|
});
|
|
91
94
|
}
|
|
92
|
-
function
|
|
93
|
-
return
|
|
95
|
+
function A(d, r, o, a, s) {
|
|
96
|
+
return g(
|
|
94
97
|
"mentionAgent",
|
|
95
98
|
"bik-mention bik-mention--agent",
|
|
96
99
|
"@",
|
|
97
100
|
d,
|
|
98
|
-
|
|
99
|
-
{ renderItem:
|
|
101
|
+
r,
|
|
102
|
+
{ renderItem: o, renderDropdown: a, removeTriggerOnDismiss: s }
|
|
100
103
|
);
|
|
101
104
|
}
|
|
102
|
-
function
|
|
103
|
-
return
|
|
105
|
+
function E(d, r, o, a, s) {
|
|
106
|
+
return g(
|
|
104
107
|
"mentionTeam",
|
|
105
108
|
"bik-mention bik-mention--team",
|
|
106
109
|
"#",
|
|
107
110
|
d,
|
|
108
|
-
|
|
109
|
-
{ renderItem:
|
|
111
|
+
r,
|
|
112
|
+
{ renderItem: o, renderDropdown: a, removeTriggerOnDismiss: s }
|
|
110
113
|
);
|
|
111
114
|
}
|
|
112
115
|
export {
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
A as buildAgentMentionExtension,
|
|
117
|
+
E as buildTeamMentionExtension
|
|
115
118
|
};
|
|
116
119
|
//# sourceMappingURL=MentionExtension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentionExtension.js","sources":["../../../../../src/editor/extensions/mention/MentionExtension.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport Mention from '@tiptap/extension-mention';\nimport { ReactRenderer } from '@tiptap/react';\nimport type { ReactNode } from 'react';\nimport type {\n\tMentionDropdownRenderProps,\n\tMentionItem,\n} from '../../BikEditor.types';\nimport {\n\tcreateSuggestionPopup,\n\ttype SuggestionPopup,\n} from '../suggestionPopup';\nimport { MentionDropdown } from './MentionDropdown';\n\ninterface MentionBuildOptions {\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode;\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode;\n\t/** Remove the typed trigger char + query if the menu closes without a selection. */\n\tremoveTriggerOnDismiss?: boolean;\n}\n\nfunction buildRender(\n\toptions: MentionBuildOptions,\n\tpickedRef: { picked: boolean },\n) {\n\tconst { renderItem, renderDropdown, removeTriggerOnDismiss } = options;\n\treturn () => {\n\t\tlet component: ReactRenderer;\n\t\tlet popup: SuggestionPopup;\n\t\tlet latestProps: any;\n\n\t\t// Close the menu without a selection: drop the typed \"@query\" so no orphan\n\t\t// trigger is left, and mark as picked so onExit doesn't delete it twice.\n\t\tconst dismiss = () => {\n\t\t\tpickedRef.picked = true;\n\t\t\tif (latestProps?.editor && latestProps?.range) {\n\t\t\t\tconst { editor, range } = latestProps;\n\t\t\t\teditor.chain().focus().deleteRange(range).run();\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\tonStart: (props: any) => {\n\t\t\t\tlatestProps = props;\n\t\t\t\tpickedRef.picked = false;\n\t\t\t\tcomponent = new ReactRenderer(MentionDropdown, {\n\t\t\t\t\tprops: { ...props, renderItem, renderDropdown, dismiss },\n\t\t\t\t\teditor: props.editor,\n\t\t\t\t});\n\t\t\t\tpopup = createSuggestionPopup(component.element, props.clientRect);\n\t\t\t},\n\t\t\tonUpdate: (props: any) => {\n\t\t\t\tlatestProps = props;\n\t\t\t\tcomponent.updateProps({\n\t\t\t\t\t...props,\n\t\t\t\t\trenderItem,\n\t\t\t\t\trenderDropdown,\n\t\t\t\t\tdismiss,\n\t\t\t\t});\n\t\t\t\tif (!props.items?.length) {\n\t\t\t\t\tpopup.hide();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpopup.show();\n\t\t\t\tpopup.updatePosition(props.clientRect);\n\t\t\t},\n\t\t\tonKeyDown: (props: any) => {\n\t\t\t\tif (props.event.key === 'Escape') {\n\t\t\t\t\tpopup.hide();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn (component.ref as any)?.onKeyDown(props) ?? false;\n\t\t\t},\n\t\t\tonExit: () => {\n\t\t\t\tpopup.destroy();\n\t\t\t\tcomponent.destroy();\n\t\t\t\t// Nothing was picked → strip the orphan \"@query\" the user typed.\n\t\t\t\tif (\n\t\t\t\t\tremoveTriggerOnDismiss &&\n\t\t\t\t\t!pickedRef.picked &&\n\t\t\t\t\tlatestProps?.editor &&\n\t\t\t\t\tlatestProps?.range\n\t\t\t\t) {\n\t\t\t\t\tconst { editor, range } = latestProps;\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (!editor.isDestroyed) {\n\t\t\t\t\t\t\teditor.chain().deleteRange(range).run();\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 0);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t};\n}\n\n/**\n * Builds a TipTap Mention extension.\n *\n * Each inserted node carries an optional `kind` attribute. When set, the chip is\n * rendered WITHOUT the trigger char (the `label` already encodes the full text)\n * and a `data-kind` attribute is emitted so CSS can colour it per kind. When\n * `kind` is null the legacy `${char}${label}` chip is rendered (back-compatible).\n */\nfunction buildMentionExtension(\n\tname: 'mentionAgent' | 'mentionTeam',\n\tcssClass: string,\n\tchar: '@' | '#',\n\titemsRef: { current: MentionItem[] },\n\tonSelect: ((item: MentionItem, char: '@' | '#') => void) | undefined,\n\toptions: MentionBuildOptions,\n) {\n\tconst pickedRef = { picked: false };\n\n\treturn Mention.extend({\n\t\tname,\n\t\taddAttributes() {\n\t\t\treturn {\n\t\t\t\t...this.parent?.(),\n\t\t\t\tkind: {\n\t\t\t\t\tdefault: null,\n\t\t\t\t\tparseHTML: (el: HTMLElement) => el.getAttribute('data-kind'),\n\t\t\t\t\trenderHTML: (attrs: Record<string, unknown>) =>\n\t\t\t\t\t\tattrs['kind'] ? { 'data-kind': String(attrs['kind']) } : {},\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t}).configure({\n\t\tHTMLAttributes: { class: cssClass },\n\t\trenderText: ({ options: opt, node }: any) =>\n\t\t\t`${node.attrs['kind'] ? '' : opt.suggestion.char}${node.attrs['label']}`,\n\t\trenderHTML: ({ options: opt, node }: any) => [\n\t\t\t'span',\n\t\t\tmergeAttributes(\n\t\t\t\topt.HTMLAttributes,\n\t\t\t\tnode.attrs['kind'] ? { 'data-kind': String(node.attrs['kind']) } : {},\n\t\t\t),\n\t\t\t`${node.attrs['kind'] ? '' : opt.suggestion.char}${node.attrs['label']}`,\n\t\t],\n\t\tsuggestion: {\n\t\t\tchar,\n\t\t\tallowSpaces: true,\n\t\t\titems: ({ query }: { query: string }) =>\n\t\t\t\titemsRef.current.filter((a) =>\n\t\t\t\t\ta.label.toLowerCase().includes(query.toLowerCase()),\n\t\t\t\t),\n\t\t\tcommand: ({ editor, range, props }: any) => {\n\t\t\t\tpickedRef.picked = true;\n\t\t\t\teditor\n\t\t\t\t\t.chain()\n\t\t\t\t\t.focus()\n\t\t\t\t\t.deleteRange(range)\n\t\t\t\t\t.insertContent({\n\t\t\t\t\t\ttype: name,\n\t\t\t\t\t\tattrs: {\n\t\t\t\t\t\t\tid: props.id,\n\t\t\t\t\t\t\tlabel: props.label,\n\t\t\t\t\t\t\tkind: props.meta?.kind ?? null,\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t\t.run();\n\t\t\t\tonSelect?.(props, char);\n\t\t\t},\n\t\t\trender: buildRender(options, pickedRef),\n\t\t},\n\t});\n}\n\nexport function buildAgentMentionExtension(\n\tagentsRef: { current: MentionItem[] },\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n\tremoveTriggerOnDismiss?: boolean,\n) {\n\treturn buildMentionExtension(\n\t\t'mentionAgent',\n\t\t'bik-mention bik-mention--agent',\n\t\t'@',\n\t\tagentsRef,\n\t\tonSelect,\n\t\t{ renderItem, renderDropdown, removeTriggerOnDismiss },\n\t);\n}\n\nexport function buildTeamMentionExtension(\n\tteamsRef: { current: MentionItem[] },\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n\tremoveTriggerOnDismiss?: boolean,\n) {\n\treturn buildMentionExtension(\n\t\t'mentionTeam',\n\t\t'bik-mention bik-mention--team',\n\t\t'#',\n\t\tteamsRef,\n\t\tonSelect,\n\t\t{ renderItem, renderDropdown, removeTriggerOnDismiss },\n\t);\n}\n"],"names":["buildRender","options","pickedRef","renderItem","renderDropdown","removeTriggerOnDismiss","component","popup","latestProps","dismiss","editor","range","props","ReactRenderer","MentionDropdown","createSuggestionPopup","buildMentionExtension","name","cssClass","char","itemsRef","onSelect","Mention","el","attrs","opt","node","mergeAttributes","query","a","buildAgentMentionExtension","agentsRef","buildTeamMentionExtension","teamsRef"],"mappings":";;;;;AAqBA,SAASA,EACRC,GACAC,GACC;AACD,QAAM,EAAE,YAAAC,GAAY,gBAAAC,GAAgB,wBAAAC,EAAA,IAA2BJ;AAC/D,SAAO,MAAM;AACZ,QAAIK,GACAC,GACAC;AAIJ,UAAMC,IAAU,MAAM;AAErB,UADAP,EAAU,SAAS,IACfM,GAAa,UAAUA,GAAa,OAAO;AAC9C,cAAM,EAAE,QAAAE,GAAQ,OAAAC,EAAA,IAAUH;AAC1B,QAAAE,EAAO,QAAQ,MAAA,EAAQ,YAAYC,CAAK,EAAE,IAAA;AAAA,MAC3C;AAAA,IACD;AAEA,WAAO;AAAA,MACN,SAAS,CAACC,MAAe;AACxB,QAAAJ,IAAcI,GACdV,EAAU,SAAS,IACnBI,IAAY,IAAIO,EAAcC,GAAiB;AAAA,UAC9C,OAAO,EAAE,GAAGF,GAAO,YAAAT,GAAY,gBAAAC,GAAgB,SAAAK,EAAA;AAAA,UAC/C,QAAQG,EAAM;AAAA,QAAA,CACd,GACDL,IAAQQ,EAAsBT,EAAU,SAASM,EAAM,UAAU;AAAA,MAClE;AAAA,MACA,UAAU,CAACA,MAAe;AAQzB,YAPAJ,IAAcI,GACdN,EAAU,YAAY;AAAA,U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SAAOW;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACAiB;AAAA,IACAZ;AAAA,IACA,EAAE,YAAAlB,GAAY,gBAAAC,GAAgB,wBAAAC,EAAA;AAAA,EAAuB;AAEvD;"}
|
|
1
|
+
{"version":3,"file":"MentionExtension.js","sources":["../../../../../src/editor/extensions/mention/MentionExtension.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport Mention from '@tiptap/extension-mention';\nimport { ReactRenderer } from '@tiptap/react';\nimport type { ReactNode } from 'react';\nimport type {\n\tMentionDropdownRenderProps,\n\tMentionItem,\n} from '../../BikEditor.types';\nimport {\n\tcreateSuggestionPopup,\n\ttype SuggestionPopup,\n} from '../suggestionPopup';\nimport { MentionDropdown } from './MentionDropdown';\n\ninterface MentionBuildOptions {\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode;\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode;\n\t/** Remove the typed trigger char + query if the menu closes without a selection. */\n\tremoveTriggerOnDismiss?: boolean;\n}\n\nfunction buildRender(\n\toptions: MentionBuildOptions,\n\tpickedRef: { picked: boolean },\n) {\n\tconst { renderItem, renderDropdown, removeTriggerOnDismiss } = options;\n\treturn () => {\n\t\tlet component: ReactRenderer;\n\t\tlet popup: SuggestionPopup;\n\t\tlet latestProps: any;\n\t\t// Closes the menu when the user clicks anywhere outside it. The `@` popup\n\t\t// lives on document.body (not inside the editor), so nothing dismisses it on\n\t\t// an outside click otherwise — only Escape / moving the cursor did.\n\t\tlet onDocMouseDown: ((event: MouseEvent) => void) | null = null;\n\n\t\t// Close the menu without a selection: drop the typed \"@query\" so no orphan\n\t\t// trigger is left, and mark as picked so onExit doesn't delete it twice.\n\t\tconst dismiss = () => {\n\t\t\tpickedRef.picked = true;\n\t\t\tif (latestProps?.editor && latestProps?.range) {\n\t\t\t\tconst { editor, range } = latestProps;\n\t\t\t\teditor.chain().focus().deleteRange(range).run();\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\tonStart: (props: any) => {\n\t\t\t\tlatestProps = props;\n\t\t\t\tpickedRef.picked = false;\n\t\t\t\tcomponent = new ReactRenderer(MentionDropdown, {\n\t\t\t\t\tprops: { ...props, renderItem, renderDropdown, dismiss },\n\t\t\t\t\teditor: props.editor,\n\t\t\t\t});\n\t\t\t\tpopup = createSuggestionPopup(component.element, props.clientRect);\n\t\t\t\tonDocMouseDown = (event: MouseEvent) => {\n\t\t\t\t\tconst target = event.target as Node | null;\n\t\t\t\t\tif (!target) return;\n\t\t\t\t\t// Inside the picker → keep open (row clicks fire on `click`).\n\t\t\t\t\tif (popup.element.contains(target)) return;\n\t\t\t\t\t// Inside the editor → the suggestion plugin already closes it.\n\t\t\t\t\tconst editorDom = latestProps?.editor?.view?.dom as\n\t\t\t\t\t\t| HTMLElement\n\t\t\t\t\t\t| undefined;\n\t\t\t\t\tif (editorDom?.contains(target)) return;\n\t\t\t\t\t// Anywhere else → drop the typed \"@query\" (no refocus — clicking\n\t\t\t\t\t// away shouldn't yank focus back) and close.\n\t\t\t\t\tpickedRef.picked = true;\n\t\t\t\t\tif (latestProps?.editor && latestProps?.range) {\n\t\t\t\t\t\tlatestProps.editor.chain().deleteRange(latestProps.range).run();\n\t\t\t\t\t}\n\t\t\t\t\tpopup.hide();\n\t\t\t\t};\n\t\t\t\tdocument.addEventListener('mousedown', onDocMouseDown);\n\t\t\t},\n\t\t\tonUpdate: (props: any) => {\n\t\t\t\tlatestProps = props;\n\t\t\t\tcomponent.updateProps({\n\t\t\t\t\t...props,\n\t\t\t\t\trenderItem,\n\t\t\t\t\trenderDropdown,\n\t\t\t\t\tdismiss,\n\t\t\t\t});\n\t\t\t\tif (!props.items?.length) {\n\t\t\t\t\tpopup.hide();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpopup.show();\n\t\t\t\tpopup.updatePosition(props.clientRect);\n\t\t\t},\n\t\t\tonKeyDown: (props: any) => {\n\t\t\t\tif (props.event.key === 'Escape') {\n\t\t\t\t\tpopup.hide();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn (component.ref as any)?.onKeyDown(props) ?? false;\n\t\t\t},\n\t\t\tonExit: () => {\n\t\t\t\tif (onDocMouseDown) {\n\t\t\t\t\tdocument.removeEventListener('mousedown', onDocMouseDown);\n\t\t\t\t\tonDocMouseDown = null;\n\t\t\t\t}\n\t\t\t\tpopup.destroy();\n\t\t\t\tcomponent.destroy();\n\t\t\t\t// Nothing was picked → strip the orphan \"@query\" the user typed.\n\t\t\t\tif (\n\t\t\t\t\tremoveTriggerOnDismiss &&\n\t\t\t\t\t!pickedRef.picked &&\n\t\t\t\t\tlatestProps?.editor &&\n\t\t\t\t\tlatestProps?.range\n\t\t\t\t) {\n\t\t\t\t\tconst { editor, range } = latestProps;\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (!editor.isDestroyed) {\n\t\t\t\t\t\t\teditor.chain().deleteRange(range).run();\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 0);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t};\n}\n\n/**\n * Builds a TipTap Mention extension.\n *\n * Each inserted node carries an optional `kind` attribute. When set, the chip is\n * rendered WITHOUT the trigger char (the `label` already encodes the full text)\n * and a `data-kind` attribute is emitted so CSS can colour it per kind. When\n * `kind` is null the legacy `${char}${label}` chip is rendered (back-compatible).\n */\nfunction buildMentionExtension(\n\tname: 'mentionAgent' | 'mentionTeam',\n\tcssClass: string,\n\tchar: '@' | '#',\n\titemsRef: { current: MentionItem[] },\n\tonSelect: ((item: MentionItem, char: '@' | '#') => void) | undefined,\n\toptions: MentionBuildOptions,\n) {\n\tconst pickedRef = { picked: false };\n\n\treturn Mention.extend({\n\t\tname,\n\t\taddAttributes() {\n\t\t\treturn {\n\t\t\t\t...this.parent?.(),\n\t\t\t\tkind: {\n\t\t\t\t\tdefault: null,\n\t\t\t\t\tparseHTML: (el: HTMLElement) => el.getAttribute('data-kind'),\n\t\t\t\t\trenderHTML: (attrs: Record<string, unknown>) =>\n\t\t\t\t\t\tattrs['kind'] ? { 'data-kind': String(attrs['kind']) } : {},\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t}).configure({\n\t\tHTMLAttributes: { class: cssClass },\n\t\trenderText: ({ options: opt, node }: any) =>\n\t\t\t`${node.attrs['kind'] ? '' : opt.suggestion.char}${node.attrs['label']}`,\n\t\trenderHTML: ({ options: opt, node }: any) => [\n\t\t\t'span',\n\t\t\tmergeAttributes(\n\t\t\t\topt.HTMLAttributes,\n\t\t\t\tnode.attrs['kind'] ? { 'data-kind': String(node.attrs['kind']) } : {},\n\t\t\t),\n\t\t\t`${node.attrs['kind'] ? '' : opt.suggestion.char}${node.attrs['label']}`,\n\t\t],\n\t\tsuggestion: {\n\t\t\tchar,\n\t\t\tallowSpaces: true,\n\t\t\titems: ({ query }: { query: string }) =>\n\t\t\t\titemsRef.current.filter((a) =>\n\t\t\t\t\ta.label.toLowerCase().includes(query.toLowerCase()),\n\t\t\t\t),\n\t\t\tcommand: ({ editor, range, props }: any) => {\n\t\t\t\tpickedRef.picked = true;\n\t\t\t\teditor\n\t\t\t\t\t.chain()\n\t\t\t\t\t.focus()\n\t\t\t\t\t.deleteRange(range)\n\t\t\t\t\t.insertContent({\n\t\t\t\t\t\ttype: name,\n\t\t\t\t\t\tattrs: {\n\t\t\t\t\t\t\tid: props.id,\n\t\t\t\t\t\t\tlabel: props.label,\n\t\t\t\t\t\t\tkind: props.meta?.kind ?? null,\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t\t.run();\n\t\t\t\tonSelect?.(props, char);\n\t\t\t},\n\t\t\trender: buildRender(options, pickedRef),\n\t\t},\n\t});\n}\n\nexport function buildAgentMentionExtension(\n\tagentsRef: { current: MentionItem[] },\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n\tremoveTriggerOnDismiss?: boolean,\n) {\n\treturn buildMentionExtension(\n\t\t'mentionAgent',\n\t\t'bik-mention bik-mention--agent',\n\t\t'@',\n\t\tagentsRef,\n\t\tonSelect,\n\t\t{ renderItem, renderDropdown, removeTriggerOnDismiss },\n\t);\n}\n\nexport function buildTeamMentionExtension(\n\tteamsRef: { current: MentionItem[] },\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n\tremoveTriggerOnDismiss?: boolean,\n) {\n\treturn buildMentionExtension(\n\t\t'mentionTeam',\n\t\t'bik-mention bik-mention--team',\n\t\t'#',\n\t\tteamsRef,\n\t\tonSelect,\n\t\t{ renderItem, renderDropdown, removeTriggerOnDismiss },\n\t);\n}\n"],"names":["buildRender","options","pickedRef","renderItem","renderDropdown","removeTriggerOnDismiss","component","popup","latestProps","onDocMouseDown","dismiss","editor","range","props","ReactRenderer","MentionDropdown","createSuggestionPopup","event","target","buildMentionExtension","name","cssClass","char","itemsRef","onSelect","Mention","el","attrs","opt","node","mergeAttributes","query","a","buildAgentMentionExtension","agentsRef","buildTeamMentionExtension","teamsRef"],"mappings":";;;;;AAqBA,SAASA,EACRC,GACAC,GACC;AACD,QAAM,EAAE,YAAAC,GAAY,gBAAAC,GAAgB,wBAAAC,EAAA,IAA2BJ;AAC/D,SAAO,MAAM;AACZ,QAAIK,GACAC,GACAC,GAIAC,IAAuD;AAI3D,UAAMC,IAAU,MAAM;AAErB,UADAR,EAAU,SAAS,IACfM,GAAa,UAAUA,GAAa,OAAO;AAC9C,cAAM,EAAE,QAAAG,GAAQ,OAAAC,EAAA,IAAUJ;AAC1B,QAAAG,EAAO,QAAQ,MAAA,EAAQ,YAAYC,CAAK,EAAE,IAAA;AAAA,MAC3C;AAAA,IACD;AAEA,WAAO;AAAA,MACN,SAAS,CAACC,MAAe;AACxB,QAAAL,IAAcK,GACd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AA,MAAA;AAAA,MAEpD,SAAS,CAAC,EAAE,QAAApB,GAAQ,OAAAC,GAAO,OAAAC,QAAiB;AAC3C,QAAAX,EAAU,SAAS,IACnBS,EACE,QACA,MAAA,EACA,YAAYC,CAAK,EACjB,cAAc;AAAA,UACd,MAAMQ;AAAA,UACN,OAAO;AAAA,YACN,IAAIP,EAAM;AAAA,YACV,OAAOA,EAAM;AAAA,YACb,MAAMA,EAAM,MAAM,QAAQ;AAAA,UAAA;AAAA,QAC3B,CACA,EACA,IAAA,GACFW,IAAWX,GAAOS,CAAI;AAAA,MACvB;AAAA,MACA,QAAQtB,EAAYC,GAASC,CAAS;AAAA,IAAA;AAAA,EACvC,CACA;AACF;AAEO,SAAS+B,EACfC,GACAV,GACArB,GACAC,GACAC,GACC;AACD,SAAOc;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACAe;AAAA,IACAV;AAAA,IACA,EAAE,YAAArB,GAAY,gBAAAC,GAAgB,wBAAAC,EAAA;AAAA,EAAuB;AAEvD;AAEO,SAAS8B,EACfC,GACAZ,GACArB,GACAC,GACAC,GACC;AACD,SAAOc;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACAiB;AAAA,IACAZ;AAAA,IACA,EAAE,YAAArB,GAAY,gBAAAC,GAAgB,wBAAAC,EAAA;AAAA,EAAuB;AAEvD;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -369,42 +369,43 @@ import { TestimonialCard as BT } from "./components/testimonial-card/Testimonial
|
|
|
369
369
|
import { TextPickerModal as LT } from "./components/text-picker/TextPickerModal.js";
|
|
370
370
|
import { TimePicker as yT } from "./components/datePicker/TimePicker.js";
|
|
371
371
|
import { Toaster as FT } from "./components/toaster/Toaster.js";
|
|
372
|
-
import {
|
|
373
|
-
import {
|
|
374
|
-
import {
|
|
375
|
-
import {
|
|
376
|
-
import {
|
|
377
|
-
import {
|
|
378
|
-
import {
|
|
379
|
-
import {
|
|
380
|
-
import {
|
|
381
|
-
import {
|
|
382
|
-
import {
|
|
383
|
-
import {
|
|
384
|
-
import {
|
|
385
|
-
import {
|
|
386
|
-
import {
|
|
387
|
-
import {
|
|
388
|
-
import {
|
|
389
|
-
import {
|
|
390
|
-
import {
|
|
391
|
-
import {
|
|
392
|
-
import {
|
|
393
|
-
import {
|
|
394
|
-
import {
|
|
395
|
-
import {
|
|
396
|
-
import {
|
|
397
|
-
import {
|
|
398
|
-
import {
|
|
399
|
-
import {
|
|
400
|
-
import {
|
|
401
|
-
import {
|
|
402
|
-
import {
|
|
403
|
-
import {
|
|
404
|
-
import {
|
|
405
|
-
import {
|
|
406
|
-
import {
|
|
407
|
-
import {
|
|
372
|
+
import { ToolSource as bT } from "./components/agent-builder/constants/tools.js";
|
|
373
|
+
import { Tooltip as VT } from "./components/tooltips/Tooltip.js";
|
|
374
|
+
import { TruncateValue as GT, calculatePercentage as vT, roundNumber as WT, truncateValueForIndianStore as YT, truncateValueForInternationalStore as KT, truncateValueTo10K as QT, truncateValueToA as XT, truncateValueToB as zT, truncateValueToC as jT, truncateValueToK as ZT, truncateValueToL as qT, truncateValueToM as JT, truncateValueToT as $T } from "./components/analytics-chips-and-dropdowns/chart/utils/calcPercentage.js";
|
|
375
|
+
import { VariableEditorHelper as rc } from "./components/template-preview/helpers/VariableEditorHelper.js";
|
|
376
|
+
import { VariablePicker as tc } from "./components/variable-picker-v3/VariablePicker.js";
|
|
377
|
+
import { VerticalBarAndLinearGraph as fc } from "./components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js";
|
|
378
|
+
import { VerticalGraph as mc } from "./components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js";
|
|
379
|
+
import { VideoModal as xc } from "./components/feature-announcements/VideoModal.js";
|
|
380
|
+
import { WhatsAppFormatToHTML as ic } from "./components/template-preview/helpers/WhatsAppFormatToHTML.js";
|
|
381
|
+
import { WhatsAppTextEditor as dc } from "./components/WhatsAppTextEditor/WhatsAppTextEditor.js";
|
|
382
|
+
import { WhatsNew as Tc } from "./components/whats-new/WhatsNew.js";
|
|
383
|
+
import { WhatsNewButton as Ac } from "./components/whats-new/WhatsNewButton.js";
|
|
384
|
+
import { WhatsNewPanel as Sc } from "./components/whats-new/WhatsNewPanel.js";
|
|
385
|
+
import { WhatsNewProvider as Ic, useWhatsNewContext as Pc } from "./components/whats-new/WhatsNewProvider.js";
|
|
386
|
+
import { WhatsappIntegrationError as _c } from "./utils/logging/ErrorConstructor/WhatsappIntegrationError.js";
|
|
387
|
+
import { WhatsappLikePreview as Oc } from "./components/template-preview/WhatsApp/WhatsAppLikePreview.js";
|
|
388
|
+
import { WhatsappLikePreviewV2 as Nc } from "./components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js";
|
|
389
|
+
import { buildAgentMentionItems as Dc, editorDocToInstructions as Lc, instructionsToEditorHtml as Mc } from "./components/agent-builder/utils/mentionSerialization.js";
|
|
390
|
+
import { environment as kc } from "./firebase/environment.js";
|
|
391
|
+
import { getAllDataFromTemplateComponent as Uc, getAllDataFromWebpushTemplateComponent as bc } from "./components/template-context-mapper/utils/getDataFromTemplateComponent.js";
|
|
392
|
+
import { getAuthMethods as Vc, getFirestoreLiteMethods as Hc, getFirestoreMethods as Gc, getFunctionsMethods as vc, getMessagingMethods as Wc, getStorageMethods as Yc } from "./firebase/lazyFirebaseMethods.js";
|
|
393
|
+
import { getBodyHtml as Qc, getSectionsHtml as Xc } from "./editor/BikEditor.utils.js";
|
|
394
|
+
import { getFireStoreDb as jc } from "./firebase/lazyFirestore.js";
|
|
395
|
+
import { getFireStoreLiteDb as qc } from "./firebase/lazyFirestoreLite.js";
|
|
396
|
+
import { getFirebaseChatStorage as $c } from "./firebase/lazyStorage.js";
|
|
397
|
+
import { isVariable as rA, validateIsUrl as eA } from "./components/template-context-mapper/utils/validateIsUrl.js";
|
|
398
|
+
import { queryBuilderCacheSlice as aA } from "./components/QueryBuilder/redux/queryBuilderCache.reducer.js";
|
|
399
|
+
import { queryBuilderSlice as pA } from "./components/QueryBuilder/redux/queryBuilder.reducer.js";
|
|
400
|
+
import { renderVariableUIForPreview as lA } from "./components/template-preview/helpers/SmsTemplateHelper.js";
|
|
401
|
+
import { resizeImage as nA } from "./utils/resizeImage.js";
|
|
402
|
+
import { toLiveChatText as sA } from "./editor/serializers/toLiveChatText.js";
|
|
403
|
+
import { toWhatsAppText as uA } from "./editor/serializers/toWhatsAppText.js";
|
|
404
|
+
import { unwrapDropdownValue as cA } from "./components/dropdown/utils.js";
|
|
405
|
+
import { useAIChat as CA } from "./components/bik-chatbot/services/useAIChat.js";
|
|
406
|
+
import { useAgentDraft as EA } from "./components/agent-builder/hooks/useAgentDraft.js";
|
|
407
|
+
import { useFeatureAnnouncements as PA } from "./components/feature-announcements/hooks/useFeatureAnnouncements.js";
|
|
408
|
+
import { useWhatsNew as _A } from "./components/whats-new/useWhatsNew.js";
|
|
408
409
|
export {
|
|
409
410
|
up as ACTIONS_TYPES,
|
|
410
411
|
Pp as AD_STRING_OPERATORS,
|
|
@@ -886,11 +887,12 @@ export {
|
|
|
886
887
|
w as TitleSmall,
|
|
887
888
|
V as TitleXlarge,
|
|
888
889
|
FT as Toaster,
|
|
889
|
-
bT as
|
|
890
|
+
bT as ToolSource,
|
|
891
|
+
VT as Tooltip,
|
|
890
892
|
Si as TooltipStyled,
|
|
891
893
|
kf as TrainingIcon,
|
|
892
894
|
Uf as TriangleError,
|
|
893
|
-
|
|
895
|
+
GT as TruncateValue,
|
|
894
896
|
Ep as UNSUBSCRIBE_URL_OPTION,
|
|
895
897
|
Pl as URL_PATTERN,
|
|
896
898
|
wf as Undo,
|
|
@@ -899,97 +901,97 @@ export {
|
|
|
899
901
|
q as UnsatisfactoryResponseList,
|
|
900
902
|
vf as Upload,
|
|
901
903
|
Yf as UserIcon,
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
904
|
+
rc as VariableEditorHelper,
|
|
905
|
+
tc as VariablePicker,
|
|
906
|
+
fc as VerticalBarAndLinearGraph,
|
|
905
907
|
Qf as VerticalDots,
|
|
906
908
|
zf as VerticalFullScreenModal,
|
|
907
|
-
|
|
909
|
+
mc as VerticalGraph,
|
|
908
910
|
Zf as VideoCamcorder,
|
|
909
|
-
|
|
911
|
+
xc as VideoModal,
|
|
910
912
|
Jf as VideoRecorder,
|
|
911
913
|
op as Warning,
|
|
912
914
|
ep as WarningIcon,
|
|
913
915
|
ap as Website,
|
|
914
|
-
|
|
915
|
-
|
|
916
|
+
ic as WhatsAppFormatToHTML,
|
|
917
|
+
dc as WhatsAppTextEditor,
|
|
916
918
|
Xp as WhatsAppTextEditorHeader,
|
|
917
|
-
|
|
918
|
-
|
|
919
|
+
Tc as WhatsNew,
|
|
920
|
+
Ac as WhatsNewButton,
|
|
919
921
|
pp as WhatsNewIcon,
|
|
920
922
|
Ul as WhatsNewIconContainer,
|
|
921
|
-
|
|
922
|
-
|
|
923
|
+
Sc as WhatsNewPanel,
|
|
924
|
+
Ic as WhatsNewProvider,
|
|
923
925
|
bl as WhatsNewWrapper,
|
|
924
926
|
lp as WhatsappChannel,
|
|
925
927
|
np as WhatsappColor,
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
928
|
+
_c as WhatsappIntegrationError,
|
|
929
|
+
Oc as WhatsappLikePreview,
|
|
930
|
+
Nc as WhatsappLikePreviewV2,
|
|
929
931
|
sp as WhiteStarFilled,
|
|
930
|
-
|
|
931
|
-
|
|
932
|
+
Dc as buildAgentMentionItems,
|
|
933
|
+
vT as calculatePercentage,
|
|
932
934
|
rm as computeAiTagOnAccept,
|
|
933
935
|
Vx as createSessionRecord,
|
|
934
936
|
Ni as dateOptions,
|
|
935
937
|
Ex as defaultTabs,
|
|
936
|
-
|
|
937
|
-
|
|
938
|
+
Lc as editorDocToInstructions,
|
|
939
|
+
kc as environment,
|
|
938
940
|
Rl as filterPhoneCandidates,
|
|
939
941
|
rl as formatDate,
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
942
|
+
Uc as getAllDataFromTemplateComponent,
|
|
943
|
+
bc as getAllDataFromWebpushTemplateComponent,
|
|
944
|
+
Vc as getAuthMethods,
|
|
945
|
+
Qc as getBodyHtml,
|
|
946
|
+
jc as getFireStoreDb,
|
|
947
|
+
qc as getFireStoreLiteDb,
|
|
948
|
+
$c as getFirebaseChatStorage,
|
|
949
|
+
Hc as getFirestoreLiteMethods,
|
|
950
|
+
Gc as getFirestoreMethods,
|
|
951
|
+
vc as getFunctionsMethods,
|
|
952
|
+
Wc as getMessagingMethods,
|
|
951
953
|
pd as getOrInitFirebaseChatApp,
|
|
952
|
-
|
|
953
|
-
|
|
954
|
+
Xc as getSectionsHtml,
|
|
955
|
+
Yc as getStorageMethods,
|
|
954
956
|
Gl as getUrlForBannerThirdPartyIcon,
|
|
955
957
|
jx as initialDynamicCouponErrorState,
|
|
956
958
|
Zx as initialStaticCouponErrorState,
|
|
957
|
-
|
|
959
|
+
Mc as instructionsToEditorHtml,
|
|
958
960
|
_l as isCompleteFormatting,
|
|
959
961
|
hl as isCompleteMarkdownLink,
|
|
960
962
|
Ol as isCompleteUrl,
|
|
961
|
-
|
|
963
|
+
rA as isVariable,
|
|
962
964
|
md as lazyChatConfig,
|
|
963
965
|
ld as lazyStagingConfig,
|
|
964
966
|
em as levenshteinDistance,
|
|
965
|
-
|
|
966
|
-
|
|
967
|
+
aA as queryBuilderCacheSlice,
|
|
968
|
+
pA as queryBuilderSlice,
|
|
967
969
|
o as regexPatterns,
|
|
968
|
-
|
|
969
|
-
|
|
970
|
+
lA as renderVariableUIForPreview,
|
|
971
|
+
nA as resizeImage,
|
|
970
972
|
xd as rnSecondaryAuth,
|
|
971
|
-
|
|
973
|
+
WT as roundNumber,
|
|
972
974
|
gl as stripMarkdownFormatting,
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
975
|
+
sA as toLiveChatText,
|
|
976
|
+
uA as toWhatsAppText,
|
|
977
|
+
YT as truncateValueForIndianStore,
|
|
978
|
+
KT as truncateValueForInternationalStore,
|
|
979
|
+
QT as truncateValueTo10K,
|
|
980
|
+
XT as truncateValueToA,
|
|
981
|
+
zT as truncateValueToB,
|
|
982
|
+
jT as truncateValueToC,
|
|
983
|
+
ZT as truncateValueToK,
|
|
984
|
+
qT as truncateValueToL,
|
|
985
|
+
JT as truncateValueToM,
|
|
986
|
+
$T as truncateValueToT,
|
|
987
|
+
cA as unwrapDropdownValue,
|
|
988
|
+
CA as useAIChat,
|
|
987
989
|
Jp as useAIContext,
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
990
|
+
EA as useAgentDraft,
|
|
991
|
+
PA as useFeatureAnnouncements,
|
|
992
|
+
_A as useWhatsNew,
|
|
993
|
+
Pc as useWhatsNewContext,
|
|
994
|
+
eA as validateIsUrl,
|
|
993
995
|
K as validateURL
|
|
994
996
|
};
|
|
995
997
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|